We have a C# FTP class which works great but we are running out of TCP ports because they are all in the TIME-WAIT state and cannot be reused. We can decrease the default TIME-WAIT in the registry but we would rather reuse the ports.
So given the blog below: http://blogs.technet.com/b/networking/archive/2010/08/11/how-tcp-time-wait-assassination-works.aspx
In a situation where the server side socket goes to a TIME-WAIT state and the client reconnects to the server within 2MSL (default TIME-WAIT time), there are 2 things that can happen:
1.The server will not respond to the SYN packets from the client because the socket is in the TIME-WAIT state.
2.The server may accept the SYN from the client and change the state of the socket from TIME-WAIT to ESTABLISHED. This is known as TIME-WAIT assassination, or incarnation of a previous connection.
The key to scenario ‘2’ above is that the ISN (Initial Sequence number) of the SYN sent needs to be higher than the highest sequence number used in the previous session. If the ISN is not as expected, the server will not respond to the SYN and the socket will wait for 2MSL before being available for use again.
I am trying (programmatically in C#) to find a way to always send a SYN sent with a higher number than the highest sequence number used in previous session.
Is that possible to achieve?