Open humblecscoder opened 5 years ago
I can confirm this is an existing Bug and noticed this in one of my applications as well. If i reconnect after a crash/Websocket Error, i noticed that it does not properly update the Websocket State. E.g. after recreating the connection and being connected and receiving data everything is fine BUT but the Websocket State: when i query the Websocket State it says "Connecting" instead of "Open" (what it should logically show).
Hello, kerryjiang. I facced with the situation, when I try to reconnect to server, that temporarily unavailable, with setting LocalEndPoint. I catch exception in WebSocket.OnError event: WSAEADDRINUSE(10048) Only one usage of each socket address (protocol/network address/port) is normally permitted. And each time my reconnect timer elapsed I always catch this exception.
When I try to reconnect without setting LocalEndPoint. It works well. My suggestion that Socket not properly cleans up. SuperSocket.ClientEngine in TcpClientSession ProcessConnect maybe add this lines.
Maybe I'm doing something wrong and there's a way to reconnect correctly with setting each time LocalEndPoint. I am using: .Net 4.5 Webscoket4net 0.15.2.11 SuperSocket.ProtoBase 1.7.0.17 SuperSocket.ClientEngine 0.10.0.0