Click to See Complete Forum and Search --> : Can't receive udp packets


jkolar
July 18th, 2007, 05:37 AM
Hi folks! I have simple udp time server and clients programs (http://www.codeproject.com/internet/udptime.asp), but i have problem, that these programs dont function, when server is run on my workstation. On other computers there is no problem. When i was debuging udp server program i found, that program all the time is waiting for incomming data in function recvfrom. I used packet sniffer program (Wireshark) to capture incomming packet from time client, there is no problem. Udp request came to my computer, but why this packet dont reach application? I have installed only standard windows firewall, but i dont use it (i have disabled it).
I am using communication port 161 (because i am developing some software for snmp-simple network management and udp time programs use as test software for udp).

Operating system used: Windows XP with service pack2
Developing enviroment: visual studio 2005

jkolar
July 18th, 2007, 05:54 AM
I found, that udp packets that dont reach application, are recorded in netstat statistics as discarded packets:

c:\Program Files\Resource Kit>netstat -s

IPv4 Statistics

Packets Received = 108562
Received Header Errors = 0
Received Address Errors = 1439
Datagrams Forwarded = 0
Unknown Protocols Received = 0
Received Packets Discarded = 17533 <<<-----------------------------
Received Packets Delivered = 89910
Output Requests = 71782
Routing Discards = 0
Discarded Output Packets = 0
Output Packet No Route = 0
Reassembly Required = 0
Reassembly Successful = 0
Reassembly Failures = 0
Datagrams Successfully Fragmented = 0
Datagrams Failing Fragmentation = 0
Fragments Created = 0

----------------------------------------------------------------
In packets sniffer program all seems to be OK, all checksums are correct. What can be reason, that incomming packet is discarded?

MikeAThon
July 18th, 2007, 07:01 PM
Are you sending and receiving to the same port number? The article you cited gave the port_number as 5000, whereas in your post you mentioned that you are using 161. You need to set the server so that it is listening on the same port that the client is transmitting to.

jkolar
July 19th, 2007, 01:57 AM
Port number is defined as command line parameter. There is no problem with this. You can use virtually anything (if this number isnt currently used).

MikeAThon
July 19th, 2007, 11:43 AM
Yes I know that. I was simply asking if you used the same port for both client and server. Are you?

Assuming the answer is "yes", and given that the program works on other computers, then you need to focus on the offending machine. What are the differences? Is it behind a router, relative to the clients? If you switch roles, i.e., put the client on the offending machine and the server elsewhere, can the offending machine send UDP successfully to the server? And receive responses? What happens if you try different ports?

Mike

jkolar
July 23rd, 2007, 03:13 AM
The computers, on which I have tried this, are in one room connected to common router.
Strange, when I switch server and client, there is no problem with udp sending and receiving.
All this happen independently of port number.

MikeAThon
July 23rd, 2007, 12:15 PM
If you switch machines for client and server, and then it works, then this tends to point to firewall and/or routing difficulties.

Look again for firewalls on the offending machine. Some programs install them without really calling them firewalls. Norton is famous for this, and one machine might have two or three firewalls running on it.

You mentioned that the machines are connected to a common router. Are all the machines also on the same LAN and the same subnet? If not there might be a routing issue.

Mike

jkolar
July 24th, 2007, 03:02 AM
Thanks! You where right. This time I am using on my work computer NOD32 antivirus, but i found in Control Panel->Add&Remove Programs, that I have in my windows also Norton Antivirus&Norton Security Center (norton has also running system service for monitoring of firewalls or something like this). I uninstalled these and all is ok. Once more, thank you very much.

jkolar
July 24th, 2007, 03:03 AM
Problem was, that i had norton antivirus neither in start->programs neither in tray bar. I was unaware, that i am using also norton products.

MikeAThon
July 24th, 2007, 11:47 AM
Norton strikes again ;)

Glad it's working for you now.