首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

堵塞模式的recv如何会报Ewouldblock异常

2013-11-08 
堵塞模式的recv怎么会报Ewouldblock错误?RT: windows下是没有问题的代码移植到linux下,就报了EWOULDBLOCK

堵塞模式的recv怎么会报Ewouldblock错误?
RT:

 windows下是没有问题的
代码移植到linux下,就报了EWOULDBLOCK错误,此错误不是在非堵塞模式下 才会出现的吗?
[解决办法]
是设置了SO_RCVTIMEO 吧
[解决办法]

       SO_RCVTIMEO
              Sets the timeout value that specifies the maximum amount of time an input function waits until it completes. It accepts a timeval structure with the
              number  of  seconds and microseconds specifying the limit on how long to wait for an input operation to complete. If a receive operation has blocked
              for this much time without receiving additional data, it shall return with a partial count or errno set to [EAGAIN] or [EWOULDBLOCK] if no  data  is
              received.  The  default for this option is zero, which indicates that a receive operation shall not time out. This option takes a timeval structure.
              Note that not all implementations allow this option to be set.

热点排行