Closed solarin closed 4 years ago
I propose to remove the tcpClient initialization in TcpTransport from the constructor
I think I agree with this. PR?
and automatically reconnect the tcpClient if it's disconnected rather than throwing the exception
But I don't agree with this.
why not?
try at least to reconnect a couple of times and then throw the exception.
is it too dirty?
I'd prefer if the user of TLSharp handles the reconnection.
the production code i am running is conceptually as simple as this:
the thing is that there are two issues:
client.IsConnected always returns true, unless it's fixed with my previous fix by adding a check on null on sender in IsConnected
if for any reason the tcpClient in TcpTransport becomes disconnected, there is no way to reconnect it and the Send method will always throw an exception (below)
I propose to remove the tcpClient initialization in TcpTransport from the constructor and automatically reconnect the tcpClient if it's disconnected rather than throwing the exception