WSADeleteSocketPeerTargetName function (ws2tcpip.h)
The WSADeleteSocketPeerTargetName function removes the association between a peer target name and an IP address for a socket. After a successful return, there will be no future association between the IP address and the target name.
INT WSAAPI WSADeleteSocketPeerTargetName( [in] SOCKET Socket, [in] const sockaddr *PeerAddr, [in] ULONG PeerAddrLen, [in, optional] LPWSAOVERLAPPED Overlapped, [in, optional] LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine );
A descriptor identifying a socket on which the peer target name is being deleted.
The IP address of the peer for which the target name is being deleted.
The size, in bytes, of the PeerAddr parameter.
[in, optional] Overlapped
A pointer to a WSAOVERLAPPED structure. This parameter is ignored for non-overlapped sockets.
[in, optional] CompletionRoutine
A pointer to the completion routine called when the operation has been completed. This parameter is ignored for non-overlapped sockets.
If the function succeeds, the return value is 0. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.
Some possible error codes are listed below.
|The specified address family is not supported.|
|The system detected an invalid address pointer in attempting to use a pointer argument of a call. This error is returned if the PeerAddr parameter was a NULL pointer.|
|An invalid parameter was passed. This error is returned if the socket passed in the Socket parameter was not created with an address family of the AF_INET or AF_INET6 and a socket type of SOCK_DGRAM or SOCK_STREAM.|
|A buffer passed was too small.|
|The descriptor passed in the Socket parameter is not a valid socket.|
The WSADeleteSocketPeerTargetName function provides a method to remove the association between a peer target name and an IP address for a socket. This function is used to delete a peer target name that was previously set with the WSASetSocketPeerTargetName function. After the WSADeleteSocketPeerTargetName function returns, no future authentication to the IP address will use the previously specified target name. This function is primarily designed to be used by connectionless clients (for example, a socket created with the type set to SOCK_DGRAM or the protocol set to IPPROTO_UDP) after they have terminated the connection with the IP address associated with the peer target name. For connection oriented clients (for example, a socket created with the type set to SOCK_STREAM or protocol set to IPPROTO_TCP), this function should not be called.
The WSADeleteSocketPeerTargetName function simplifies having to call the WSAIoctl function with a dwIoControlCode parameter set to SIO_DELETE_PEER_TARGET_NAME.
An error will be returned if the following conditions are not met.
- The address family of the Socket parameter must be either AF_INET or AF_INET6.
- The socket type must be either SOCK_STREAM or SOCK_DGRAM.
|Minimum supported client||Windows Vista [desktop apps only]|
|Minimum supported server||Windows Server 2008 [desktop apps only]|
Using Secure Socket Extensions
Windows Filtering Platform API Functions