I’m slightly confused here. Usually when I connect Windows telnet to a simple echo server, it echoes every keystroke.
Now, for some reason it stacks a few of them and sends them to the server. Is this normal behavior? Is there any reason for this strange inconsistency?
Example:
Client:
>>blahblahblah
>>
Echo server:
I recieved "b"
I recieved "lahbl"
I recieved "ahbla"
I recieved "h\r\n"
It depends on the buffering on both sides. The client waits for the end of line to send the available characters. The echo server reads, but read gets what’s available, and depending on the randomness of the network and buffering, this may be anything from 1 character up to all you sent.
With TCP, everything is guaranteed to get there, but not necessarily at the same time or in the same chunks that you sent it.