kerryjiang / WebSocket4Net

A popular .NET WebSocket Client
Apache License 2.0
764 stars 273 forks source link

Re-open a closed websocket, get an exception of "An unhandled exception of type #99

Open jliu1970 opened 7 years ago

jliu1970 commented 7 years ago

'System.Exception' occurred in SuperSocket.ClientEngine.dll Additional information: The socket is connected, you needn't connect again! occurred

Hi Kerry,

In an error handling case, our design of the handler of websocket Closed event will try to re-establish the connection. The connection code looks like :

if(!(websocket.state == WebSocketState.Open)) { websocket.open(); }

In one of the test case, we shut down the websocket server at the server side, it is found that the code does not work all the time, the above exception was thrown in some instances.

When the exception was thrown, we noticed that the websocket.state was closed, as expected.

Any reason why the socket is still connected, when the websocket is closed?

Thanks Jimmy

kerryjiang commented 7 years ago

Could you try the latest version: 0.15?

jliu1970 commented 7 years ago

Kerry,

Sorry that I missed your previous communication. I will pick up the latest version.

Thanks Jimmy

On Mon, Sep 4, 2017 at 11:37 PM, Kerry Jiang notifications@github.com wrote:

Could you try the latest version: 0.15?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kerryjiang/WebSocket4Net/issues/99#issuecomment-327069248, or mute the thread https://github.com/notifications/unsubscribe-auth/Aac_y8j-gVq2OPZ0VWVy8dUqUKSoEhXuks5sfNAmgaJpZM4OahhW .

kristijan97 commented 6 years ago

Same issue here. What can be the cause? @kerryjiang

nowkin commented 6 years ago

Same issue for me too also with the latest version. Any news here?