How to use UdpClient class?
-
I am trying to receive the udp datagram that from the client sended to the server port 7090,but i have some questions following. 1) How to listen to port 7090? Should I setup a timer to scan port 7090? 2) Is there a event that start when the udp datagram get to the server and how to implement? 3) If many client send to the same server port 7090 in the same time. How can I to sure which one is from where? thanks for your help!
-
I am trying to receive the udp datagram that from the client sended to the server port 7090,but i have some questions following. 1) How to listen to port 7090? Should I setup a timer to scan port 7090? 2) Is there a event that start when the udp datagram get to the server and how to implement? 3) If many client send to the same server port 7090 in the same time. How can I to sure which one is from where? thanks for your help!
UdpClient.Receive
is a blocking call, and there is no events on theUdpClient
. You use it to send packets to a server or multicast group and then callUdpClient.Receive
to wait for a response. You should read the class documentation[^] for theUdpClient
in the .NET Framework SDK. It contains all the information you should need plus many examples of how to use it.Microsoft MVP, Visual C# My Articles