今天在用WebSocket做客户端连接服务端的时候出现如下异常:

java.io.IOException: java.util.concurrent.ExecutionException: java.net.SocketException: Connection reset by peer: socket write error

异常的详细信息:

Caused by: java.net.SocketException: Connection reset by peer: socket write error

初步分析,是客户端没有正确关闭连接就断开连接造成服务端报以上异常,只要正确关闭客户端的连接就可以了。

正常关闭客户端就不报异常了

Caused by: java.net.SocketException: Connection reset by peer: socket write error

正常关闭客户端连接的核心代码:

Caused by: java.net.SocketException: Connection reset by peer: socket write error

希望能给大家一些参考,谢谢!!!

相关文章:

  • 2022-12-23
  • 2021-06-18
  • 2021-07-25
  • 2021-09-10
  • 2022-12-23
猜你喜欢
  • 2021-04-29
  • 2021-07-06
  • 2022-12-23
  • 2021-11-10
  • 2021-12-12
  • 2021-07-03
  • 2021-05-16
相关资源
相似解决方案