LookupPersistentUdpPortReservation function (iphlpapi.h)
The LookupPersistentUdpPortReservation function looks up the token for a persistent UDP port reservation for a consecutive block of TCP ports on the local computer.
Syntax
IPHLPAPI_DLL_LINKAGE ULONG LookupPersistentUdpPortReservation(
[in] USHORT StartPort,
[in] USHORT NumberOfPorts,
[out] PULONG64 Token
);
Parameters
[in] StartPort
The starting UDP port number in network byte order.
[in] NumberOfPorts
The number of UDP port numbers that were reserved.
[out] Token
A pointer to a port reservation token that is returned if the function succeeds.
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 zero is passed in the StartPort or NumberOfPorts parameters. |
|
The element was not found. This error is returned if persistent port block specified by the StartPort and NumberOfPorts parameters could not be found. |
|
Use FormatMessage to obtain the message string for the returned error. |
Remarks
The LookupPersistentUdpPortReservation function is defined on Windows Vista and later.
The LookupPersistentUdpPortReservation function is used to lookup the token for a persistent reservation for a block of UDP ports.
A persistent reservation for a block of UDP ports is created by a call to the CreatePersistentUdpPortReservation function. The StartPort or NumberOfPorts parameters passed to the LookupPersistentUdpPortReservation function must match the values used when the persistent reservation for a block of TCP ports was created by the CreatePersistentUdpPortReservation function.
If the LookupPersistentUdpPortReservation function succeeds, the Token parameter returned will point to the token for the persistent port reservation for the block of UDP ports. Note that the token for a given persistent reservation for a block of TCP ports may change each time the system is restarted.
An application can request port assignments from the UDP port reservation by opening a UDP socket, then calling the WSAIoctl function specifying the SIO_ASSOCIATE_PORT_RESERVATION IOCTL and passing the reservation token before issuing a call to the bind function on the socket.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 [desktop apps only] |
Target Platform | Windows |
Header | iphlpapi.h |
Library | Iphlpapi.lib |
DLL | Iphlpapi.dll |
See also
CreatePersistentTcpPortReservation
CreatePersistentUdpPortReservation
DeletePersistentTcpPortReservation
DeletePersistentUdpPortReservation