linux listen函数第2个参数,Listen第二个参数的意义

但是继续man listen函数 看到如下解释

The  behavior  of  the  backlog  argument on TCP sockets changed with Linux 2.2.  Now it specifies the queue length for completely established sockets waiting to be accepted,  instead  of  the  number  of  incomplete  connection  requests.   The  maximum  length  of  the  queue  for  incomplete  sockets   can   be   set   using  /proc/sys/net/ipv4/tcp_max_syn_backlog.   When  syncookies are enabled there is no logical maximum length and this setting is ignored.  See tcp(7) for more information.

在linux 2.2以后  listen的第二个参数。指的是在完成TCP三次握手后的队列。即在系统accept之前的队列。已经完成的队列。如果系统没有调用accpet把这个队列的数据拿出来。一旦这个队列满了。未连接队列的请求过不来。导致未连接队列里的请求会超时或者拒绝。如果系统调用了accpet队列接受请求数据。那么就会把接受到请求移除已完成队列。 这时候已完成队列又可以使用了。

最后 说了如果开启了syncookies  忽略listen的第二个参数。

syncookie 主要是为了防止syn flood攻击。这里暂时先不说。以后再补充

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值