The accept()
blocks, until another connection is made and the return the sockfd the can communicate both sides on. But why is it accept()
that blocks, when the first thing that is done is the three way handshake. And the handshake is not done by accept()
, but by listen()
. So I would expect to listen()
block rather then accept()
, since it is firstly involved in TCP. I know the kernel does some queuing of the incoming connections, but still the very first function involved in is listen()
, then the connection is moved forward in the queue to accept()
. So when I do first connection, listen()
will do the 3whs, and the server blocks in accpet()
. So another connection cannot do another 3whs, becuase the server does no go back to listen()
, which does the 3whs? Or why does accept()
blocks and not listen()
?