SO_LINGER and closing sockets (WINSOCK)

im is writing a multi-threaded winsock and im application, having some problems with closing sockets. First of all, is there a limit for several simultaneously open sockets? allows you to talk like 32 sockets all at once.

I establish a connection on one of the sockets and transmit the information, and everything goes correctly. the problem is that when I disconnect the socket and then reconnect to the same destination, I get RST from the server after my SYN. I do not have code for the server application, so I can not debug it.

when I used SO_LINGER and it sent the RST flag at the end of each session - it worked. but I do not want to end my ties this way. when SO_LINGER was not used, the FIN flag was sent, but it seems that the connection was not really closed.

any help? thank

+3
source share
2 answers

Firstly, I agree with Nikolai, are you binding your client socket?

, TIME_WAIT . , , 2MSL, , , , , , , , .

-, , Windows, , .

" ", " " , - ( , ). , Vista, " ", Windows, 70 000 XP XP (. : http://www.lenholgate.com/blog/2005/11/windows-tcpip-server-performance.html). , , ( , ), 4000 , MAX_USER_PORT : TCP/IP - Win XP SP3 .

+2

Unix - , Windows "".

, bind() - . , , . .

+1

Source: https://habr.com/ru/post/1745301/


All Articles