so-linger

SO_LINGER and closing sockets(WINSOCK)

我是研究僧i 提交于 2019-12-14 03:53:00
问题 im writing a multithreaded winsock application and im having some issues with closing the sockets. first of all, is there a limit for a number of simultaneously open sockets? lets say like 32 sockets all in once. i establish a connection on one of the sockets, and passing information and it all goes right. problem is when i disconnect the socket and then reconnect to the same destination, i get a RST from the server after my SYN. i dont have the code for the server app so i cant debug it.

TCP option SO_LINGER (zero) - when it's required

那年仲夏 提交于 2019-11-26 00:31:00
问题 I think I understand the formal meaning of the option. In some legacy code I\'m handling now, the option is used. The customer complains about RST as response to FIN from its side on connection close from its side. I am not sure I can remove it safely, since I don\'t understand when it should be used. Can you please give an example of when the option would be required? 回答1: The typical reason to set a SO_LINGER timeout of zero is to avoid large numbers of connections sitting in the TIME_WAIT