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

dennis2 (Dennis)
<本文发表于: 相约加拿大:枫下论坛 >
... 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.
<本文发表于: 相约加拿大:枫下论坛 >

2001-11-10 -04:00

回到话题: 请问高手,关于网络管理的面试题。。。

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论