I am working at a game on wich i am writing both the client(flex3) and server(java) myself. I know the server works perfectly as i checked it extensively with telnet and i had no problems. The problem comes when i use my flex client to connect to the server instead of telnet, but is quite strange: the client always manages to connect to the server with no problems, but when it has to receive the data from the server sometimes it gets it all, but some times gets only parts of it, a couple of characters missing here and there (and i enfasize that with telnet, doing the same things i get all the data). I googled about it, but i had no luck. Any help would be very much apreciated!
I don’t know if this helps, but I had some problems with Flash reading/sending sockets recently because I didn’t have a zero byte in my php server. “\0”
Yes, i had the same problem at the begining when reading the data sent from the server and i solved it adding a null byte at the end of each bunch of data sent from server. I should add to description of the problem for wich i opened this thread, that it happens almost exclusively when server sends a lot of data. In the java server i implemented a nio reactor pattern, on wich each client has its own buffer to send and receive data. I’ve been playing with the ByteBuffer, and i realized that when i increase its size the problem seems to diminish. It also seems that the missing bites are always the last ones being flushed by the server buffer, but this is not a rule, as it seems to happen randomly, or at best every 50-60 times the buffer on the server is flushed…
It means your java socket implementation is flawed, tcp provides a reliable guaranteed order and delivery for packets flash is merely receiving the data that the server sends it.
So wherever the problem is its on the serverside end and has nothing to do with flash.
In other words the reason flash isn’t receiving all of the data is because your server isn’t sending it, its as simple as that.
I don’t know… I’ll take another look at the server, but i insist, when using telnet instead of the flash client, i have no problems at all… this is very weird…
I found the problem… and it had nothing to do with the sockets… when manipulating the strings i was cutting them wrong… thanks for the replys anyway!