This documentation is archived and is not being maintained.

IPGlobalProperties.GetActiveUdpListeners Method

Note: This method is new in the .NET Framework version 2.0.

Returns information about the Internet Protocol version 4 (IPv4) User Datagram Protocol (UDP) listeners on the local computer.

Namespace: System.Net.NetworkInformation
Assembly: System (in system.dll)

public abstract IPEndPoint[] GetActiveUdpListeners ()
public abstract IPEndPoint[] GetActiveUdpListeners ()
public abstract function GetActiveUdpListeners () : IPEndPoint[]

Return Value

An IPEndPoint array that contains objects that describe the UDP listeners, or an empty array if no UDP listeners are detected.

Exception typeCondition

NetworkInformationException

The call to the Win32 function GetUdpTable failed.

UDP is a connectionless transport layer protocol that is responsible for sending and receiving datagrams. It is defined in IETF RFC 768.

A UDP listener is an open socket that waits for and receives UDP datagrams. Because UDP is a connectionless protocol, the listener does not maintain a connection to a remote endpoint.

The following example displays the active UDP listeners.

public static void ShowActiveUdpListeners()
{
            Console.WriteLine("Active UDP Listeners");
           IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
           IPEndPoint[] endPoints =  properties.GetActiveUdpListeners();
           foreach (IPEndPoint e in endPoints)
           {
                  Console.WriteLine(e.ToString());
           }
}

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Show: