我编写一个服务端程序,但是客户端一退出服务端就报错,大家看看怎么解决!java.io.IOException: 远程主机强迫关闭了一个现有的连接。
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(Unknown Source)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.read(Unknown Source)
at sun.nio.ch.SocketChannelImpl.read(Unknown Source) ByteBuffer bytebuffer = (ByteBuffer)selectionkey.attachment();
SocketChannel socketchanne = (SocketChannel)selectionkey.channel();
ByteBuffer bytebuffer_new = ByteBuffer.allocate(1024);
socketchanne.read(bytebuffer_new);
bytebuffer_new.flip();
bytebuffer.limit(bytebuffer.capacity());
bytebuffer.put(bytebuffer_new);
bytebuffer.flip();