0

I have written a udp server which receives client requests using a recvfrom() socket system call, this call receives requests from localhost only, no remote host requests are seen by the recvfrom() call. I tried capturing packets on the receivng port and I can see the packets coming from remote server, but the request don't reach recvfrom(), what could be the matter?

Kevin
  • 40,767
Akbar
  • 1
  • 3
    You're probably only listening on localhost. Impossible to tell without seeing your code, or the output of netstat -an | grep the_port_you_use. – Mat Nov 11 '11 at 09:28
  • @Mat
    I have two different sockets listening on the same port (one for TCP and one for UDP)

    tcp 0 0 0.0.0.0:32000 0.0.0.0:* LISTEN 31196/agentd
    udp 0 0 0.0.0.0:32000 0.0.0.0:* 31196/agentd

    – Akbar Nov 11 '11 at 10:16
  • 1
    Already checked firewall configurations? "Seeing" packets with tcpdump doesn't mean that they pass a firewall if one is active. – ktf Nov 11 '11 at 10:59
  • Right, solved, firewall is blocking the udp packets. But I dont see any problem with TCP packets even though the firewall is running. Thanks #ktf – Akbar Nov 14 '11 at 06:06

1 Answers1

1

Check to make sure a firewall isn't active. tcpdump can see packets as they arrive on an interface, before a firewall has processed and dropped them

(Adapted from ktf's comment)

Michael Mrozek
  • 93,103
  • 40
  • 240
  • 233