TCP handshake phases corresponding to select() and accept() return points
I have a TCP server that creates a (blocking) socket, waits until it is available for reading using select(), then calls accept() and开发者_如何学Go starts reading the data.
Here is an example (not mine) illustrating the concept.The question is, at what points of TCP handshake does select() and accept() calls return?
Ubuntu Hardy, if it matters.
2.6.31-14-server #48ya1 SMP Fri Apr 2 15:43:25 MSD 2010 x86_64 GNU/LinuxThe select()
returns, indicating that the listening socket is "readable", immediately after the last packet in that diagram is recieved.
If you had blocked on accept()
instead, it would have returned at that same point (when the server socket transitions to ESTABLISHED).
精彩评论