It's "listenning socket". From network programming point of view, ...

dennis2 (Dennis)
本文发表在 rolia.net/zh 相约加拿大网上社区枫下论坛
... if you want to create a TCP server, you call socket() first to create a socket. Then you fill out the sockaddr structure (with IP address and port number) and call bind() to assign the address and port to the socket. Then you call listen() to convert the socket into a passive socket so that it will accept incoming connections. That's why the socket is called "listenning socket" up until now.

Next you call accept() to retrieve the next completed connection and you get a connected socket. This is different from the listenning socket.

From "UNIX Network Programming Vol 1" (by Richard Stevens) P.100:

"A given server normally creates only one listenning socket, which then exists for the lifetime of the server. The kernel then creates one connected socket for each client connection that is accepted (which the TCP three-way handshake completes). When the server is finished serving the given client, the connected socket is closed."

So that's why I say, only connected socket can be used as the identifier of a TCP sesssion, not listenning socket.
更多精彩文章及讨论,请光临枫下论坛. 网址: rolia.net/zh
2001-11-10 -04:00
This post has been archived. It cannot be replied.
Page address has been copied. To share, click to copy page address.
Share Online by QR Code

Back To Topic: 请问高手,关于网络管理的面试题。。。

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论