Passing Autumn

The same 3 years, and some people from students to as the MVP, and I was in place, then the code to show off the autumn wind, a little sad, a little cool!

公告信息
Content is very powerful ~ ~ ~ ~ ~ ~ Do not look outside the invasion not as sharp and brother, I felt kind of sense of loss ~ ~ ~

Socket:由于系统缓冲区空间不足或队列已满,不能执行套接字上的操作

最近服务器的Socket代理软件经常报这个错误:

log:Error On : 2013-5-17 0:01:00
由于系统缓冲区空间不足或队列已满,不能执行套接字上的操作。
   在 System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   在 System.Net.Sockets.Socket.Bind(EndPoint localEP)
   在 AdKiller.SocketPool.CreateSocketWithoutConnect(Uri hostUri, IPEndPoint p)

英文版 叫:

An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.

今天抽空,查了一下网络,基本上发生的问题的原因如下:

默认只有5000可用端口,每次绑定使用后,默认需要120秒后才能恢复使用。

所以,由于代理软件会大量请求转发,所以很频繁,以至于出现这种问题。

解决的方法很简单:

1:修改默认可用端口数:

注册表下:HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

新增加一项:MaxUserPort

对应的值:6万个左右就OK了。

看着MaxUserPort这个词,我在怀疑是不是作者打错字,会不会是MaxUsePort,经过多数查找,还是发现前者的多的,所以估算应该是“最大用户端口”,而不是“最大使用端口”

2:修改间隔的恢复时间:

注册表下:HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

新增加一项:TcpTimedWaitDelay

对应的值:10s 左右。

特此记录。

Autumn Park is QBlog the official site, created by the passing autumn, based on the framework data layers developed cyqdata support multi-user, multi-language, multi-database (access, mssql, oracle), directory level url and other powerful blog system
新浪微博粉丝精灵,刷粉丝、刷评论、刷转发、企业商家微博营销必备工具"

2013/5/19 23:17:30 | Other | |

#1游客[注册][222.185.26.*]2015/4/21 9:51:02
我这默认就是这个设置,但是服务器的句柄数还是不断的增加,达到6w多的时候 就报错 :由于系统缓冲区空间不足或队列已满,不能执行套接字上的操作 还是不知道什么原因,希望大师能指点指点 qin252016@qq.com
  • 发表评论