GetTeredoPort function (netioapi.h)

The GetTeredoPort function retrieves the dynamic UDP port number used by the Teredo client on the local computer.


  [out] USHORT *Port


[out] Port

A pointer to the UDP port number. On successful return, this parameter will be filled with the port number used by the Teredo client.

Return value

If the function succeeds, the return value is NO_ERROR.

If the function fails, the return value is one of the following error codes.

Return code Description
An invalid parameter was passed to the function. This error is returned if a NULL pointer is passed in the Port parameter.
The device is not ready. This error is returned if the Teredo client is not started on the local computer.
The request is not supported. This error is returned if no IPv6 stack is on the local computer.
Use FormatMessage to obtain the message string for the returned error.


The GetTeredoPort function is defined on Windows Vista and later.

The GetTeredoPort function retrieves the current UDP port number used by the Teredo client for the Teredo service port. The Teredo port is dynamic and can change any time the Teredo client is restarted on the local computer. An application can register to be notified when the Teredo service port changes by calling the NotifyTeredoPortChange function.

The Teredo client also uses static UDP port 3544 for listening to multicast traffic sent on multicast IPv4 address as defined in RFC 4380. For more information, see

The GetTeredoPort function is used primarily by firewall applications in order to configure the appropriate exceptions to allow incoming and outgoing Teredo traffic.


Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header netioapi.h (include Iphlpapi.h)
Library Iphlpapi.lib
DLL Iphlpapi.dll

See also