Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UdpClient in C# <-- My client is not receiving broadcasts.

Status
Not open for further replies.

Wengkius

Programmer
Jan 11, 2004
3
MY
Some introductions first. Am currently studying TCP/UDP connections for an upcoming project. Read through the examples in MSDN and tried to write some code using UdpClient for both server and client. The broadcaster by all means worked but the problem is that the datagrams are not reaching my client. FYI, I'm running both server and client on the same machine. I do have a connection to a LAN. Out of desperation, I tried running the example code provided by MSDN for UDP services using UdpClient but still, even the MSDN examples failed to work. I do believe that this problem ocurred due to improper configuration of the IP endpoint. Can someone point out to me how to configure the IP endpoint properly? My IP address in the LAN is currently 172.17.8.31 but I also want to know how to run this thing if I don't have a LAN connection. Is that possible?
 
If you are running both client and server on the same machine, then you can always use the loopback interface, even if you don't have a network connection. Loopback address is 127.0.0.1.

You didn't say what OS you are running, but if it is XP and you have the firewall enabled, it is possible, and potentially even likely, that you are filtering the UDP packets.

Also, if you are doing anything like this, I would recommend that you install ethereal. It will allow you to capture the packets and determine what is wrong, like getting RST packets when the remote port is closed.


pansophic
 
Thanks for the loopback address thingie! I asked around and someone else suggested too. Guess I must've overlooked that. Anyway, I checked out some source codes from csharp-corner.net and found out that I did not bind the UDP socket of my listener to the IPEndPoint... plus a load of other mistakes in configuring the connecting. Learnt so much about TCP/UDP along the way while trying to solve this prob.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top