Home Forums Support Closed/closing connection strategy Reply To: Closed/closing connection strategy

#2269
Anonymous
Inactive

Is using TCPConnection.GetConnection at every call going to slow down my application? Is it thread safe?

The only additional step performed when using TCPConnection.GetConnection is to lookup the connection in a dictionary. If it has been disconnected a new established connection will be returned instead.

If you make extensive use of Connection specific packet handlers a better solution would be to catch the CommunicationException if the connection is closed and reconnect manually.

Yes, most NetworkComms.Net methods are thread safe.

Once I start listening, is there a chance that the server stops by itself? If so, do I restart it in a new port?

The server will only stop listening if an exception occurs. You can enable logging or query the IsListening methods to determine what may be happening.

When you restart you can use the same port if you choose.

If hope the above answers help. You asked a lot of questions and for some of them I am not sure what you were asking. If you have any further questions please feel free to post back.

Regards,
Marc