<p>I have a .NET TCP Client that sends high volumes of messages to a (.NET async) TCP server.</p>

<p>I need to keep sending messages to the server but I run out of ports on the client due to TIME_WAIT.  </p>

<p>How can a program continually and reliably send messages without using all of the available ports?</p>

<p>Is there a method to keep reusing the same socket.  I have looked at Disconnect() and the REUSEADDRESS socket flag but cannot find any good examples of their use.  In fact most sources say not to use Disconnect as it is for lower level use (i.e. it only recycles the socket handle).</p>

<p>I'm thinking that I need to switch to UDP or perhaps there is a method using C++ and IOCP?</p>

Can your client just keep the same socket open and send messages in a loop?
```
```
open socket connection

while(running)
    send messages over socket

close socket connection
```
```