是这样的:我在同一台电脑上做客户服务通信的测试,服务采用完成端口写的,客户就一般的阻塞模型,客户程序模拟了无数连接,当连接较小时,比如100个,每秒通过循环方式这100个连接都向服务发送了数据包,大小为5000字节,共500000字节,服务端正常;当我仅把100换成2000个连接时,前5秒服务正常,后来收到客户数据将包,用WSASend()不改变数据包返回时,出现10055缓冲不足的错误,以至于服务不能再继续执行下面的操作了,请问高手改如何解决这类问题呀?
       电脑是一台2.4G,512M的兼容机。

解决方案 »

  1.   

    MSDN解释说:winsock的提供者报告说一个缓冲死锁了。
    但该怎么解决呀?
      

  2.   

    《windows网络编程》说:
    10055即WSAENOBUFS引起的原因有二:
    一、锁定页面数量
    二、未分页内存池的使用
    前一种情况问题不大,主要是第二种。一般未分页内存池的大小为物理内存的四分之一,你512M的系统即有
    128M的未分页内存池,一个连接套接字要耗略2K的未分页内存池,分配一个I/O请求数据包又需要略0.5K,
    你客户服务同机的话,大略要耗双倍的未分页内存池。你可以计算共能连接多少个客户和提交多少I/O请求数据。
      

  3.   

    VCSQLVB(九龙.君威) :
    我的客户连接完毕2000个后,未分页内存池不是很高,只是随着客户向服务发送数据的进行, 未分页内存池
    在不断的增大,直到122000K左右,即使到达100000时(没出现10055错误),客户停止发送数据,未分页内存池还是居高不下,怎样才能让其下降呀?(关闭客户的连接可以下降到初始水平,但不是我需要的,我需要保持大量的连接)
    谢谢!
      

  4.   

    msdn中有篇文章讲到这个问题
    Windows Sockets 2.0: Write Scalable Winsock Apps Using Completion Ports
    (可在msdn中搜索WSAENOBUFS wsasend找到)里面提到以下几种可能的资源不足:
    带宽
    虚拟内存
    locked page limit
    non-paged pool limit
      

  5.   

    Error 10054 (DB-Library)
    Severity Level 11
    Message Text
    Attempt to bulk copy an oversized row to SQL Server.Explanation
    This error occurs during a bulk copy operation when a row or rows in the source data file do not match the row as defined for the destination database table. It can occur due to a missing end-of-line er. It can also occur if there are more column delimiters in the source data file than currently exist in the destination database table, or if the source data file is corrupt.Action
    Verify that the source data file matches the column definitions for the database table, or create a new table to match the current data file, bulk copy the data into the database, and then manipulate the data using Transact-SQL statements. You can either manipulate the source data file or create a format file to facilitate the data transfer. You can manipulate character-based data files by using a text editing tool that accommodates the data file size and will not add special hidden characters during a save operation. The editing tool can then be used to manipulate the source data file by adding or deleting characters as necessary so that the source data file matches the table definition. You can also create a format file. The generated format file can be manipulated by a text editing tool and changed so that character positions/columns in the source data file are ignored. Native format files are more difficult to manipulate.The alternatives to manipulating the native format source data file and/or a format file are limited due to the storage of data types other than character in a binary type format. It can be difficult to manipulate this file type with any editing tool, and it is more difficult to generate and manipulate a format file. You can use the -F or the -L command-line flags to specify the first and last row in the source data file that is to be bulk copied into SQL Server. If the source data file contains a few oversized rows, these flags can be used to bulk copy up to the oversized row followed by a bulk copy operation from the row following the oversized row to the end of the data file.If you are unable to resolve this error, contact your primary support provider for assistance.