1 Socket 知识
1.1 Listen()
To accept connections, the socket is first created with Create,a backlog for incoming connections is specified with Listen, and thenthe connections are accepted with Accept. Listen applies only to socketsthat support connections, that is, those of type SOCK_STREAM. Thissocket is put into "passive" mode where incoming connections areacknowledged and queued pending acceptance by the process.
This function is typically used byservers (or any application that wants to accept connections) that could havemore than one connection request at a time: if a connection request arriveswith the queue full, the client will receive an error with an indication of WSAECONNREFUSED.
Listen attempts to continue to functionrationally when there are no available ports (descriptors). It will acceptconnections until the queue is emptied. If ports become available, a later callto Listen or Accept will refill the queue to the current or mostrecent "backlog," if possible, and resume listening for incomingconnections.
920

被折叠的 条评论
为什么被折叠?



