C UDP server access problem
Suppose you have an UDP server running on port 9030 on Linux and you can't access somehow to that UDP Server. There is no firewall or similar set up preventing access to that UDP port. And also please know that packet reaches to network stack of O.S. and when O.S. receives packet it immedi开发者_运维百科ately sends ICMP packet of Destination Port Unreachable. And to your surprise, netstat output shows that UDP server is running on the exact port you assigned as below:
udp 0 0 212.253.35.111:9030 0.0.0.0:* 722/udpServerApp
Also note that UDP Server listens on Public IP, not localhost or etc. Meaning packet reaches to that public IP Address.
So what might going wrong? What would you your best guesses? I am really confused.
You're probably not listening on the right address - e.g. listening on 127.0.0.1
(localhost) in stead of "any" address. The exact output of netstat will tell you that (but you didn't post it and asked for a guess, so here it is).
Your socket is listening on the local IP address 212.253.35.111 , on port 9030.
Verify, via tcpdump or wireshark that you really are sending the UDP packets to the IP 212.253.35.111 , port 9030.
You're either trying to connect to the wrong port, the wrong IP address, or there's a firewall (e.g. some local iptables rules) you've yet to discover, or there's a routing error and you somehow have 2 machines somewhere with the same IP address (quite possible with some load balancing/hot standby setup, e.g. if you're using VRRP)
What IP address is the UDP server bound on?
If it's only bound on 127.0.0.1
then it won't be accessible from external network interfaces.
To listen on every interface it should be bound to INADDR_ANY
.
精彩评论