Respond to a UDP message

Posted by JDCAce on Stack Overflow See other posts from Stack Overflow or by JDCAce
Published on 2013-10-26T03:52:12Z Indexed on 2013/10/26 3:53 UTC
Read the original article Hit count: 104

Filed under:
|
|
|

I have a pair of very simple C# programs (server and client). The client's user enters an IP address, and the client sends a UDP message to the server. The server uses UDPClient.Receive() to listen to IPAddress.Any, prints out the message it received and where it was sent from (the client's IP address), then sends a UDP message back to the client. The problem is in that last part: my client is not receiving any message. It listens only to the server, instead of IPAddress.Any. The SendUdpMessage() and WaitForMessage() methods are identical, except for the IPAddress.Any part. I cannot find what's wrong!

I can post the code if I need to, but I don't know which part is relevant, and I don't want to post the entire program (about 150 lines combined).

© Stack Overflow or respective owner

Related posts about c#

Related posts about sockets