0

我正在使用将打开ServerSocketChannel并绑定客户端端口的NIO线程。但是当我们尝试从Socket chanel读取数据时,显示了下面提到的异常。如果有人提供解决方案,那就太好了。

Connection reset by peer java.net.SocketException: Transport endpoint is not connected
    at sun.nio.ch.SocketChannelImpl.shutdown(Native Method)
    at sun.nio.ch.SocketChannelImpl.shutdownOutput(SocketChannelImpl.java:669)
    at sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:386)
    at iyp.trncomms.ConnRecordWriter.checkShutDown(ConnRecordWriter.java:131)
    at iyp.trncomms.ConnRecordWriter.continueWriting(ConnRecordWriter.java:214)
    at iyp.trncomms.ConnRecordWriter.retry(ConnRecordWriter.java:101)
    at iyp.trncomms.ConnRecordWriter.shutDown(ConnRecordWriter.java:92)
    at iyp.trncomms.ConnRecord$WorkingState.toOnHoldState(ConnRecord.java:1224)
    at iyp.trncomms.ConnRecord$WorkingState.onInputError(ConnRecord.java:1152)
    at iyp.trncomms.ConnRecord.read(ConnRecord.java:124)
    at iyp.trncomms.NIO.run(NIO.java:137)
4

2 回答 2

0

Connection reset by peer非常明确。您打开了连接,但远程端在您的代码执行之前将其关闭。您需要调查远程系统上的日志以了解连接过早关闭的原因。

于 2012-06-04T20:10:06.257 回答
0

你似乎是shutdownOutput()在一个错误的情况下打电话。那是行不通的:你已经遇到了一个错误,这将导致另一个错误。关掉频道就行了。

于 2012-06-05T01:40:44.513 回答