
Winsock Senddata method - confusing?!
Quote:
>If I send data from the server to a user on two separate lines of code....
> sckServer(1).SendData "This is line 1"
> sckServer(1).SendData "This is line 2"
>The client only get one dataarrival event fired with the above text on one
>line.
That's the way stream sockets work. For efficiency most stacks
implement something called the Nagel algorithm which, if you supply it
a short chunk of data via SendData, will wait a while before sending
it in the hope that you'll supply more data and the two writes can be
combined and effeciently handled.
But that's not all.
You get no guarantee that the data will arrive in one or two (or three
or five) chunks, it arrives as it arrives and that's all there is to
it. If the fact that you used two SendDatas is significant then you
need to supply some sort of an indicator that you can use on the
receiving end. You could put CRLF between the lines, preceed them
with a byte count, etc.
Zane