I have a question regarding the recv syscall.
Suppose I have a client/server and the following exchange of message took place:
Client --> Server using multiple send syscalls one after another immediately:
send "Packet1"
send "Packet2"
send "Packet3"
Server receives in the following order, taking a long time (couple of secs) to process each message received:
recv "Packet1"
-take 2 secs to process "Packet1"
recv "Packet2Packet3"
What throws me off is the second recv call that the server gets after processing the first recv call. The message is the contents of BOTH the packet 2 and packet 3 that the cilent sends.
It seems that recv reads whatever that is in the buffer, and not the sequence that message comes in. Is that true?
What I am planning to have is a server behaivor that is like this:
recv "Packet1"
- 2 sec of processing time
recv "Packet2" - 2 sec of processing time
recv "Packet3" - 2 sec of processing time
For example, since 3 messages are sent to the server, the server will have to call 3 recv explicity to get each individual message even though they are all already in the input buffer. Is that possible with recv?
Thanks