The behavior of send() and recv() in socket communication

Posted by gc on Stack Overflow See other posts from Stack Overflow or by gc
Published on 2010-04-06T13:38:22Z Indexed on 2010/04/06 13:43 UTC
Read the original article Hit count: 281

Filed under:
|
|

The following is the setup:

Server         Client
 |                |
accept         connect
 |                |
 v                |
send msg1->       | 
 |                |
 v                v
recv    <-     send
 |                |
 v                v
send msg2->    recv
 |                |
 v                v
               close

Here is my question:
1. Client actually receives msg1 before it closes, why is it like this?
2. send msg2 returns normally. Since client closes after receiving msg1, why is send msg2 successful?

© Stack Overflow or respective owner

Related posts about socket-programming

Related posts about send