开发者

setsockopt() with RCVTIMEO is not working in windows mobile5

I am trying to timeout the recieve() call on the socket descriptor, by using setsockopt() API with so_rcvtimeo option set with time set to 5 seconds. but my recieve() call is not timing out after 5 seconds when data is not recieved from开发者_高级运维 server.

may i know if there is any settings to be enabled in windows mobile 5 to get this working or is there any other way to achieve this in windows mobile 5 / pocket pc

Thanks and regards


The MSDN documentation for setsocketopt clearly states (in the Remarks section):

The following list shows BSD options that are not supported for setsockopt.

SO_ACCEPTCONN
SO_RCVLOWAT
SO_RCVTIMEO <--- Note this one
SO_SNDLOWAT
SO_SNDTIMEO
SO_TYPE

The "workaround" is to do the receive on a separate thread and wait on that thread in the caller, with a timeout that aborts the spawned thread.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜