You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, get the code withgit checkout bug-multi-message. This has been modified so the server loops, receiving multiple messages from the client, and the client is set to send three messages in sequence.
When the client sends multiple messages to the server, sometimes the server only prints out the first or second message. Weird!??!
Here the server only prints "first message", even though the client sends 3 different messages ("first message", "message 2", and "message 3"):
$ ./server
listening on port: 1234
Client ip: 127.0.0.1.
Message (34): [first message]
Client disconnected.
## tcpdump showing all three messages (in this case messages 2 and 3 were sent in one packet)
sudo tcpdump -A -i lo0 port 1234
....
22:55:10.366857 IP localhost.64833 > localhost.search-agent: Flags [P.], seq 1:15, ack 1, win 9186, options [nop,nop,TS val 746563681 ecr 746563681], length 14
E..B5h@[email protected]...=<.Q.....#..6.....
,..a,..afirst message.
22:55:10.366874 IP localhost.search-agent > localhost.64833: Flags [.], ack 15, win 9185, options [nop,nop,TS val 746563681 ecr 746563681], length 0
E..4.d@[email protected]....=<...#..(.....
,..a,..a
22:55:10.366878 IP localhost.64833 > localhost.search-agent: Flags [FP.], seq 15:35, ack 1, win 9186, options [nop,nop,TS val 746563681 ecr 746563681], length 20
E..H+$@[email protected]...=<.Q.....#..<.....
,..a,..amessage 2.message 3.
I ran the client a few more time and occasionally it gets all the messages:
First, get the code with
git checkout bug-multi-message
. This has been modified so the server loops, receiving multiple messages from the client, and the client is set to send three messages in sequence.When the client sends multiple messages to the server, sometimes the server only prints out the first or second message. Weird!??!
Here the server only prints "first message", even though the client sends 3 different messages ("first message", "message 2", and "message 3"):
I ran the client a few more time and occasionally it gets all the messages:
Other times it only gets two of them:
Why is this happening? We are using a TCP socket, so we shouldn't be losing any data!
The text was updated successfully, but these errors were encountered: