0
服务器采用Cker兄长的建议修改以后,终于基本非常稳定,但是在高峰期时候,依然存在问题,就是出现了10055的缓冲区的问题。
微软文章:Windows Sockets Error Codes (Windows),提到了:
WSAENOBUFS
10055
No buffer space available.
An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.
以是开始继续在微软逛悠。文章BUG: Send() Fails with Error WSAENOBUFS Over Blocking Socket提到:
When large blocks of data (for example, 3-4 MB) are sent over a blocking socket, send eventually fails with error 10055, WSAENOBUFS.
The online documentation indicates that send over a blocking socket should block if there is no system buffer space available:
If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in a nonblocking mode. On nonblocking stream oriented sockets, the number of bytes written can be between 1 and the requested length, depending on buffer availability on both client and server machines.
微软解决方案是:
RESOLUTION
When you encounter the problem described in the "Symptoms" section, please consider using one of the following workarounds: • Use the socket in nonblocking or asynchronous mode.
• Break large-size data blocks into small ones and specify a relatively small buffer in send for blocking sockets, preferably no larger than 64K.
• Set the SO_SNDBUF socket option to 0 (zero) to allow the stack to send from your application buffer directly.
当然该方案只针对Send有效。而我的项目问题在WSARecv出现。可见依然没有找到方案。
按照Cker的提示,看了一下sun公司的一些提示:
JavaVM does not handle WSAENOBUFS (10055) optimally
虽然是对JavaVM的,里面有一段话如下:
Embedded in
the exception's message string is code 10055. Under Win32, this error is
WSAENOBUFS which means the TCP/IP stack has temporarily run out of buffer space
and cannot complete the write. Microsoft has verified this as a bug in the
WinSock TCP/IP stack (see the MSDN article listed in the References section
above).
兄长给了一个提示,考虑重新接受的问题。
此时如果缓冲区满了,继续投递接受的话,缓冲区依然是满的,所以我考虑是否应该Sleep(1)后投递接受会带来一些好的效果。当然只是理论的研究,一会写一个大并发的测试端来模拟一下,希望能够 错误再现。
并测试这种理论是否可行!
微软文章:Windows Sockets Error Codes (Windows),提到了:
引用
WSAENOBUFS
10055
No buffer space available.
An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.
以是开始继续在微软逛悠。文章BUG: Send() Fails with Error WSAENOBUFS Over Blocking Socket提到:
引用
When large blocks of data (for example, 3-4 MB) are sent over a blocking socket, send eventually fails with error 10055, WSAENOBUFS.
The online documentation indicates that send over a blocking socket should block if there is no system buffer space available:
If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in a nonblocking mode. On nonblocking stream oriented sockets, the number of bytes written can be between 1 and the requested length, depending on buffer availability on both client and server machines.
微软解决方案是:
引用
RESOLUTION
When you encounter the problem described in the "Symptoms" section, please consider using one of the following workarounds: • Use the socket in nonblocking or asynchronous mode.
• Break large-size data blocks into small ones and specify a relatively small buffer in send for blocking sockets, preferably no larger than 64K.
• Set the SO_SNDBUF socket option to 0 (zero) to allow the stack to send from your application buffer directly.
当然该方案只针对Send有效。而我的项目问题在WSARecv出现。可见依然没有找到方案。
按照Cker的提示,看了一下sun公司的一些提示:
JavaVM does not handle WSAENOBUFS (10055) optimally
虽然是对JavaVM的,里面有一段话如下:
引用
Embedded in
the exception's message string is code 10055. Under Win32, this error is
WSAENOBUFS which means the TCP/IP stack has temporarily run out of buffer space
and cannot complete the write. Microsoft has verified this as a bug in the
WinSock TCP/IP stack (see the MSDN article listed in the References section
above).
兄长给了一个提示,考虑重新接受的问题。
此时如果缓冲区满了,继续投递接受的话,缓冲区依然是满的,所以我考虑是否应该Sleep(1)后投递接受会带来一些好的效果。当然只是理论的研究,一会写一个大并发的测试端来模拟一下,希望能够 错误再现。
并测试这种理论是否可行!
BitTorrent protocol
10055 问题设想解决方案


2008/01/11
12:16
2178



