开发者

Is there any reason for a blocking call to winsock send() function on Vista to return immediately?

Is there any reason for a blocking call to winsock's send() function on Vista to return immediately ? It works with expected delay on XP and below. I'm wondering if this has got anything to do with auto-tuning feature of Vista. Code:

   char *pBuffer; // pointer to data
   int bytes;  // total size
   int i = 0, j=0;
   while (i < bytes)
   {
    j = send(m_sock, pBuffer+i, bytes-i, 0);
开发者_运维技巧        i+=j;
   }

Thanks,

Pavan


The first possibility is that send() failed and returned SOCKET_ERROR. Your code cannot detect this, you really ought to fix that.

The next possibility is that send() just doesn't block. Which is pretty normal, it will only block when there's no buffer space left in the transport sub-system. You'll have to pump several megabytes before that happens.


probably the out going buffer is full. check the return code from send()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜