Set timeout for winsock recvfrom

后端 未结 4 1592
野性不改
野性不改 2020-12-05 19:13

I\'m trying to set up a blocking socket to timeout after 16 ms of trying to recvfrom() on a port. Platform is Windows. I\'ve looked at tons of examples online and it seems

4条回答
  •  一向
    一向 (楼主)
    2020-12-05 19:24

    WINDOWS: Timeout value is a DWORD in milliseconds, address passed to setsockopt() is const char *

    LINUX: Timeout value is a struct timeval, address passed to setsockopt() is const void *

    Source: http://forums.codeguru.com/showthread.php?t=353217

提交回复
热议问题