简体   繁体   English

无法与服务器正在侦听的端口通信

[英]Unable to communicate to a port in which server is listening

I have an application which listens to port(8087). 我有一个侦听端口(8087)的应用程序。 There is a client process which give request to this server and server will send response message back. 有一个向该服务器发出请求的客户端进程,服务器将发回响应消息。 After some requests and response, my client process is not able to connect to that port. 经过一些请求和响应后,我的客户端进程无法连接到该端口。

I could see a port listening when i used netstat tool. 使用netstat工具时,我可以看到端口在监听。 Also my process is running. 我的进程也在运行。

# netstat -a | grep 8087
tcp        0      0 0.0.0.0:8087            0.0.0.0:*               LISTEN

But i am not able to connect to that port from a client. 但是我无法从客户端连接到该端口。 What could be the reason for this? 这可能是什么原因?

Try the following steps 请尝试以下步骤

  1. On the server machines run the command "iptables -nL" to see which policies are set. 在服务器计算机上,运行命令“ iptables -nL”以查看设置了哪些策略。 If firewall rules are set, delete the rules and try connecting again. 如果设置了防火墙规则,请删除规则,然后尝试重新连接。

  2. Run following tcpdump command on the server machine 在服务器计算机上运行以下tcpdump命令

    tcdump -nnvX -s0 -iem1 host client_machine_ip and port 8087 tcdump -nnvX -s0 -iem1主机client_machine_ip和端口8087

    and following tcpdump command on the client machine 并在客户端计算机上执行tcpdump命令

    tcdump -nnvX -s0 -iem1 host server_machine_ip and port 8087 tcdump -nnvX -s0 -iem1主机server_machine_ip和端口8087

    This will tell you if client machine is sending packet out and server machine is receiving it. 这将告诉您客户端计算机是否正在发送数据包,而服务器计算机是否正在接收数据包。

  3. Run the command "netstat -ans" on server machine and under the IP and TCP labels, see if any packets are getting dropped. 在服务器计算机上的IP和TCP标签下运行命令“ netstat -ans”,查看是否有任何数据包被丢弃。

  4. Check in /var/log/messages on server machine if any errors are getting reported. 如果报告任何错误,请在服务器计算机上检入/ var / log / messages。

Hope this helps. 希望这可以帮助。

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

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