Can one recv () call get data from two consecutive send () calls?

I have a client that sends data to a server with two consecutive send calls:

send(_sockfd,msg,150,0);
send(_sockfd,msg,150,0);

and the server receives when the first send call was sent (let's say I use select):

recv(_sockfd,buf,700,0);

Notice that the buffer that I get is much larger.

my question is: is there any chance that buf will contain both msgs? Do I need 2 calls to recv () to receive both messages?

Thank you!

+3
source share
3 answers

TCP - , . // . , , , . RFC 793 - - /.

UDP. @R.. UDP ( : message). ( , MTU) TCP? , .

, () one send == one recv. . , .

  • MTU
  • ()

, a send a recv , UDP. SCTP. SCTP - .

TCP, . :

  • , (, 32 )
  • 32 (, ) ,
  • - , , . 32 , , , .

, , . , .

+4

, , , . TCP . UDP , , /.

+1

, . TCP/IP. send recv , , .

0
source

All Articles