由于服务器多次确认,TCP连接重置了吗?

时间:2018-10-05 05:35:45

标签: sockets tcp nio

我正在尝试在gps设备和java异步nio套接字通道之间建立tcp通信。 当服务器接受连接后从通道读取数据时,它将给出以下堆栈跟踪。

  

java.util.concurrent.ExecutionException:java.io.IOException:对等重置连接           在sun.nio.ch.PendingFuture.get(PendingFuture.java:185)               at com.socket.Teltonika.Codec.NioSocketServer $ 1.completed(NioSocketServer.java:50)              at com.socket.Teltonika.Codec.NioSocketServer $ 1.completed(NioSocketServer.java:32)               在sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)               在sun.nio.ch.Invoker $ 2.run(Invoker.java:218)               在sun.nio.ch.AsynchronousChannelGroupImpl $ 1.run(AsynchronousChannelGroupImpl.java:112)               在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)               在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)               在java.lang.Thread.run(Thread.java:748)       原因:java.io.IOException:对等重置连接               在sun.nio.ch.FileDispatcherImpl.read0(本机方法)               在sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)               在sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)               在sun.nio.ch.IOUtil.read(IOUtil.java:197)               在sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishRead(UnixAsynchronousSocketChannelImpl.java:387)               在sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:191)               在sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:213)               在sun.nio.ch.EPollPort $ EventHandlerTask.run(EPollPort.java:293)

当我查看tcpdump时,我发现来自客户端的重置连接。在什么情况下会发生这种情况? 我也看到服务器两次发送确认,这可能是一个问题。 x.x.x.x-Gps设备IP y.y.y.y-我的服务器IP

  

17:29:38.129012 IP(tos 0x0,ttl 115,id 43952,偏移量0,标志[DF],原始TCP(6),长度64)       xxxxlive.vodafone.in.43187> yyyy4241:标志[S],cksum 0xa168(正确),seq 1477993782,win 10880,选项[mss 1348,nop,wscale 0,nop,nop,sackOK,nop,nop,TS val 983851 ecr 0],长度为0

     

17:29:38.129056 IP(tos 0x0,ttl 64,id 0,偏移量0,标志[DF],proto TCP(6),长度60)       yyyy4241> xxxxlive.vodafone.in.43187:标志[S。],cksum 0xf0e9(错误-> 0x92e7),seq 1324366009,ack 1477993783,win 28960,选项[mss 1460,sackOK,TS val 1043927932 ecr 983851,nop ,wscale 7],长度为0

     

17:29:39.127403 IP(tos 0x0,ttl 64,id 0,偏移量0,标志[DF],proto TCP(6),长度60)       yyyy4241> xxxxlive.vodafone.in.43187:标志[S。],cksum 0xf0e9(错误-> 0x91ed),seq 1324366009,ack 1477993783,win 28960,选项[mss 1460,sackOK,TS val 1043928182 ecr 983851,nop ,wscale 7],长度为0

     

17:29:41.127397 IP(tos 0x0,ttl 64,id 0,偏移量0,标志[DF],proto TCP(6),长度60)       yyyy4241> xxxxlive.vodafone.in.43187:标志[S。],cksum 0xf0e9(错误-> 0x8ff9),seq 1324366009,ack 1477993783,win 28960,选项[mss 1460,sackOK,TS val 1043928682 ecr 983851,nop ,wscale 7],长度为0

     

17:29:42.113169 IP(tos 0x0,ttl 115,id 43953,偏移量0,标志[DF],原始TCP(6),长度52)       x.x.x.x.live.vodafone.in.43187> y.y.y.y.4241:标志[。],cksum 0x01e6(正确),ack 1,win 10880,选项[nop,nop,TS val 984747 ecr 1043928682],长度0

     

17:29:43.890057 IP(tos 0x0,ttl 115,id 0,偏移量0,标志[无],proto TCP(6),长度40)       x.x.x.x.live.vodafone.in.43187> y.y.y.y.4241:标志[R],cksum 0xac3c(正确),seq 1477993783,win 65535,长度0

当我使用netcap命令将数据发送到服务器时,确实可以完美接收数据。

echo abctest-sumangala | nc y.y.y.y 4241 //我收到了abctest-sumangala字节

0 个答案:

没有答案