System.Net.Sockets.UdpClient Class

Provides User Datagram Protocol (UDP) network services.

See Also: UdpClient Members

Syntax

public class UdpClient : IDisposable

Remarks

The System.Net.Sockets.UdpClient class provides simple methods for sending and receiving connectionless UDP datagrams in blocking synchronous mode. Because UDP is a connectionless transport protocol, you do not need to establish a remote host connection prior to sending and receiving data. You do, however, have the option of establishing a default remote host in one of the following two ways:

You can use any of the send methods provided in the System.Net.Sockets.UdpClient to send data to a remote device. Use the UdpClient.Receive(System.Net.IPEndPoint@) method to receive data from remote hosts.

Note:

Do not call UdpClient.Send(Byte[], int, System.Net.IPEndPoint) using a host name or System.Net.IPEndPoint if you have already specified a default remote host. If you do, System.Net.Sockets.UdpClient will throw an exception.

System.Net.Sockets.UdpClient methods also allow you to send and receive multicast datagrams. Use the UdpClient.JoinMulticastGroup(System.Net.IPAddress) method to subscribe a System.Net.Sockets.UdpClient to a multicast group. Use the UdpClient.DropMulticastGroup(System.Net.IPAddress) method to unsubscribe a System.Net.Sockets.UdpClient from a multicast group.

Requirements

Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0, 2.0.0.0, 4.0.0.0