kerryjiang / WebSocket4Net

A popular .NET WebSocket Client
752 stars 272 forks source link

An existing connection was forcibly closed by the remote host. #149

Open cmoles opened 5 years ago

cmoles commented 5 years ago

Hello,

We're using a websocket client on a few servers, and we're experiencing this OnError event with the following message after a day or several days of running smoothly -- sometimes all of them within minutes of each other:

System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult) at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) --- End of inner exception stack trace --- at System.Net.Security._SslStream.EndRead(IAsyncResult asyncResult) at System.Net.Security.SslStream.EndRead(IAsyncResult asyncResult) at SuperSocket.ClientEngine.AuthenticatedStreamTcpSession.OnDataRead(IAsyncResult result),System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult) at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) --- End of inner exception stack trace --- at System.Net.Security._SslStream.EndRead(IAsyncResult asyncResult) at System.Net.Security.SslStream.EndRead(IAsyncResult asyncResult) at SuperSocket.ClientEngine.AuthenticatedStreamTcpSession.OnDataRead(IAsyncResult result)

Our server's logs don't show any network issues or traffic anywhere near the times we experience this error.

Do you know what may be triggering it? We don't know how to recreate the issue, but it's been happening around once or twice a month.

kerryjiang commented 5 years ago

It seems like a certificate issue? Did you check the logs of server side?