Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IPGlobalProperties.GetActiveUdpListeners Method

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[]
Not applicable.

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 Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft