Socket Error 10055错误如何解决?(50分)

  • 主题发起人 主题发起人 netfun2000
  • 开始时间 开始时间
N

netfun2000

Unregistered / Unconfirmed
GUEST, unregistred user!
我有个程序执行老出现这样的问题:
Windows socket error:由于系统缓冲区不足或队列已满,不能执行套接字上的操作。(10055),on API 'connect'

是操作系统出了问题还是程序有问题?(我重新安装了OS就可以用了,但执行几次程序又会出现上述情况)

请问如何解决?
 
主要是clientsocket不断的连接serversocket,而serversocket此时没有连接,造成套接字连接队列满
1.保持serversocket连接
2.关闭clientsocket连接
3.定时监测连接(超过多少次或多少时长关闭clientsocket连接)
4.处理socketconnection、socketerror事件
 
Description:
10055 is an WinSock's (Microsoft's TCP/IP stack implementation) error code.

What causes this bug?
WSAENOBUFS should occur when the system has not enough memory or other system resources to open new TCP/IP socket or to handle socket data. It looks like that in most cases the problem occurs when total count of opened sockets reaches some magical number. MS writes that this limit is 3976 simultaneously opened sockets but it seems that on Win9x systems the real limit is much lower.
Proxy+ uses permanently about 10-20 opened sockets (it depends on configuration, number of defined Mapped Links,...) and each client request allocates two sockets - one for client side and one for server side of connection. Because TCP/IP system doesn't free sockets immediately when they are closed (socket remains allocated for 240 seconds after application closes it) it is possible that system will report WSAENOBUFS due to lack of free socket resources.

Solution:
There are following articles in Microsoft Knowledge base:

Windows NT/2000: http://support.microsoft.com/support/kb/articles/Q196/2/71.ASP
Windows 95: http://support.microsoft.com/support/kb/articles/Q170/7/91.ASP

Some users reported to us there is another solution for Windows 95/98/Me which solved the problem at all. Windows 95/98/Me allows up to 100 (default value) of concurrent TCP connections. It looks like when the number of connection reaches the limit 10055 error is reported. The solution is to increase the limit of simultaneous connections. You can do it by changing/creating value of the key:

HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/VxD/MSTCP/MaxConnections

If you will create the MaxConnections variable key use STRING type for it (early Windows 95 used DWORD probably). Set the value to 300 for example, restart the Windows and check whether 10055 problem disappeared.

There is MS Knowledge Base article which describes the meaning of MSTCP registry entries:
http://support.microsoft.com/support/kb/articles/Q158/4/74.ASP

Notes:
You can obtain a list of opened sockets (including sockets in close state) using netstat utility:
Run DOS Prompt and then type:

netstat -an | more

when you will press the Enter key you see a list of opened sockets (you will see big number in *_WAIT state probably).


--------------------------------------------------------------------------------

Related links:
Art10000 - Error explanations - TCP/IP errors.
 
不管我上网还不上网,启动这个程序,在我这个OS上同样出现那个错误.按照上面E文的办法错了没有效果.

To Siva
如何保持serversocket连接?
如何处理socketconnection、socketerror事件?

 
zhyesno,zjan521,刀剑如梦,东仔,多情剑客无情剑,听月人请取分。
问题在:
http://www.delphibbs.com/delphibbs/DispQ.asp?LID=2581214
 
后退
顶部