I think there have a resource leak in this method, because when an exception is thrown, the CloseConnection() have not called, I think all this method need to put in a try block, and call CloseConnection() in the finally block, in the other hand, the CloseConnection() should set all resource to null, and in GetConnection() call CloseConnection() first to ensure all resources have released especially the TCPClient object.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is a good suggestion but I have to find a way to work around firing the ConnectionClosed event so many times (before sending mainly). I'll work around this and add it to the next release.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think there have a resource leak in this method, because when an exception is thrown, the CloseConnection() have not called, I think all this method need to put in a try block, and call CloseConnection() in the finally block, in the other hand, the CloseConnection() should set all resource to null, and in GetConnection() call CloseConnection() first to ensure all resources have released especially the TCPClient object.
This is a good suggestion but I have to find a way to work around firing the ConnectionClosed event so many times (before sending mainly). I'll work around this and add it to the next release.