Socket 学习笔记

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值