When binding a client TCP socket to a specific local port with Winsock, SO_REUSEADDR does not have any effect

前端 未结 3 1463
执笔经年
执笔经年 2020-12-09 00:56

I\'m binding a client TCP socket to a specific local port. To handle the situation where the socket remains in TIME_WAIT state for some time, I use

3条回答
  •  心在旅途
    2020-12-09 01:14

    Be careful in binding the local port NOT to use the loopback address "127.0.0.1", or you will get connection timeouts. Better not to populate the sa_loc.sin_addr.s_addr at all - that works just fine.

提交回复
热议问题