java.net.SocketException: Software caused connection abort: socket write error

版权声明:博客知识产权来源命运的信徒,切勿侵权 https://blog.csdn.net/qq_37591637/article/details/86588660

原因:socket没有服务器连接

解决方案:

out = socket.getOutputStream();
            out.write(bye);
            out.flush();

这段代码之前加一句socket.accpet()就好了!


总结:无论是发送还是接受数据,socket都要先建立连接,不然会包写入错误

猜你喜欢

转载自blog.csdn.net/qq_37591637/article/details/86588660
今日推荐