WINSOCK - Setting a timeout for a connection attempt on a non existing IP?

前端 未结 3 1855
梦毁少年i
梦毁少年i 2021-02-05 08:18

I am developing a RTSP Source filter in C++, and I am using WINSOCK 2.0 - blocking socket.

When I create a blocking socket, I set its SO_RCVTIMEO to 3 secs l

3条回答
  •  不要未来只要你来
    2021-02-05 09:12

    Bite the bullet. The remote IP may not be running a PING server or PING may be blocked by some router, so it's no help. Can you not just wait the 10 sec and then make whatever error indication you use?

    If you absolutely have to time out the attempted connection after 3 seconds, you can time it out yourself.

提交回复
热议问题