SuperSocket.ClientEngine icon indicating copy to clipboard operation
SuperSocket.ClientEngine copied to clipboard

Throw InvalidOperationException in TcpClientSession.Connect() instead of Exception()

Open jamesmcguirepro opened this issue 6 years ago • 0 comments

When connect() is called on a TcpClientSession that is already connected or in process of being connected, an InvalidOperationException should be thrown, not a generic Exception.

https://github.com/kerryjiang/SuperSocket.ClientEngine/blob/6f02bd65c1d9b14c829e04e0a5a42d70dd2f4317/Core/TcpClientSession.cs#L107

https://github.com/kerryjiang/SuperSocket.ClientEngine/blob/6f02bd65c1d9b14c829e04e0a5a42d70dd2f4317/Core/TcpClientSession.cs#L110

This mimics System.Net.Socket.ConnectAsync()'s exceptions: https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.connectasync?view=netframework-4.8

jamesmcguirepro avatar Aug 08 '19 17:08 jamesmcguirepro