send时为何不能超出某一数值(我试过,4000行而5000不行,而我的数据量达到30k,怎么办,难道要分段传输?

解决方案 »

  1.   

    数MB都没有问题,发不完接着发
    int sended = 0;
    while(sended  < 200000)
    {
    int r = send(P+sended  ,200000);
    if(r<0)
    {
    //错误
    break;}
    sended  += r;
    }
      

  2.   

    int r = send(P+sended  ,200000-sended );
      

  3.   

    但我接收端每次都要根据发送的头几个字节来判断,这下我完了,我的接受端RECEIVER会接收成N次吗?
      

  4.   

    接受成N次也没关系阿,依然可以用头几个字节判断。就像pop3协议里面的头几个判断字节一样。
      

  5.   

    我知道了,你可以在最开始的字节里面设一个标志号,就像Pop3协议里面的"+"和"-",如果受到的第一个字节是标志号,就说明是一次新的,如果没有受到标志号,就把这次收到的跟上一次收到的并起来当作一次处理。
      

  6.   

    WSAEWOULDBLOCK   The socket is ed as nonblocking and the requested operation would block.if your return error is WSAEWOULDBLOCK,you should set you socket could be blocked.
    if there are to many data to send ,and the os have no enough ability to operate it,block occur