zoukankan      html  css  js  c++  java
  • 你的主机中的软件中止了一个已建立的连接。

    【错误一】
    Caused by: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。
    at sun.nio.ch.SocketDispatcher.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
    at sun.nio.ch.IOUtil.write(IOUtil.java:65)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
    at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:125)
    at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:185)
    at org.apache.coyote.http11.upgrade.NioServletOutputStream.doWriteInternal(NioServletOutputStream.java:94)
    at org.apache.coyote.http11.upgrade.NioServletOutputStream.doWrite(NioServletOutputStream.java:61)
    at org.apache.coyote.http11.upgrade.AbstractServletOutputStream.writeInternal(AbstractServletOutputStream.java:153)
    at org.apache.coyote.http11.upgrade.AbstractServletOutputStream.write(AbstractServletOutputStream.java:121)
    at org.apache.tomcat.websocket.server.WsRemoteEndpointImplServer.onWritePossible(WsRemoteEndpointImplServer.java:94)
    at org.apache.tomcat.websocket.server.WsRemoteEndpointImplServer.doWrite(WsRemoteEndpointImplServer.java:81)
    at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.writeMessagePart(WsRemoteEndpointImplBase.java:456)
    at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessage(WsRemoteEndpointImplBase.java:344)
    at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessageBlock(WsRemoteEndpointImplBase.java:276)
    ... 16 more


    【错误二】
    The WebSocket session [0] has been closed and no method (apart from close()) may be called on a closed session


    【解决办法】
    if(!s.session.isOpen()){
    System.out.println("s.session为空----------------");
    }else{
    System.out.println("session.getBasicRemote()=="+s.session.getBasicRemote());
    s.session.getBasicRemote().sendText(user.getName()+","+user.getPhoto());
    }

  • 相关阅读:
    1.两数之和
    [Udemy] ES 7 and Elastic Stack
    [Udemy] ES 7 and Elastic Stack
    Common Linux Commands 日常工作常用Linux命令
    ELK 学习
    web 3d 技术预研及数据可视化技术
    AWS Cloud Practioner 官方课程笔记
    怎么用 pytorch 查看 GPU 信息
    ECG 项目预研
    怎么查看keras 或者 tensorflow 正在使用的GPU
  • 原文地址:https://www.cnblogs.com/duanqiao123/p/8624225.html
Copyright © 2011-2022 走看看