开发者

setsockopt() with RCVTIMEO is not working in windows mobile5

开发者 https://www.devze.com 2023-03-28 09:37 出处:网络
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 se

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

精彩评论

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