Connect securely to a TCPClient C # server

I am having trouble reconnecting TCPClient (the actual class name from C #) to its server. Is there a specific way to do this? Do I need to control the tcp connection on the server if the client tries to connect to the same port,

Thanks!

+4
source share
1 answer

In most cases, you should do this the same way you first connected to it. Just remember to close the connection before trying to reconnect.

You may need a little more information, because maybe your problem is elsewhere.

You call the simple Get command, and then close the connection and try to connect again. Or you try "BeginReceived" (asynchronous connection), then you will need to handle ObjectDisposed Exception when disconnected and after that reconnect

+1
source

All Articles