简体   繁体   English

Netty客户端过一会不会发送更多数据

[英]Netty Client Won't send more data after a while

I'm writing an application that consists of a Server and a Client written with Java using Netty. 我正在编写一个由使用Netty用Java编写的服务器和客户端组成的应用程序。

I've not found a real answer to this question, but I wonder why my Server-Client connection stops being able to sen data after a while if not used. 我没有找到这个问题的真正答案,但是我想知道为什么我的服务器-客户端连接如果不使用会在一段时间后停止感知数据。 The "keepAlive" option is set to True, and it all works fine until that point where enough time has passed for the client to "disconnect" however the server doesn't receive a disconnect status. “ keepAlive”选项设置为True,并且一切正常,直到经过足够的时间让客户端“断开连接”为止,但是服务器没有收到断开连接状态。 Just generally curious, does keepAlive ping-pong the client/server or do I have to do that myself? 只是出于好奇,是keepAlive客户端/服务器进行乒乓还是我必须自己做?

Thanks! 谢谢!

Things that worth take a look at is if there is some networking gear, such as firewalls, that might had closed your connection, bear in mind that is not in the protocol the connection state handling. 值得一看的是,如果有一些网络设备(例如防火墙)可能已经关闭了您的连接,请记住,协议中没有连接状态处理。 So it is likely that you have a half closed connection . 因此,您可能有一个半封闭的连接

If you did set the keepAlive option make sure it is performing those ping over the wire. 如果确实设置了keepAlive选项,请确保它正在通过网络执行这些ping操作。 Best thing to do is to check in both sides of the connection if the socket still open. 最好的办法是检查连接的两侧,如果插座仍然打开。

While the connection is alive but idle (the client is not receiving data) check if the connection is in status ESTABLISHED . 当连接处于活动状态但处于空闲状态(客户端未接收数据)时,检查连接是否处于ESTABLISHED状态。 And do the same in the server side. 并在服务器端执行相同操作。 From there with tools such as Wireshark and trace try to establish if the connection was dropped on the server or it was killed by a firewall. 从那里使用Wiresharktrace工具尝试确定连接是在服务器上断开还是被防火墙杀死。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM