GetAcceptExSockaddrs function (mswsock.h)

The GetAcceptExSockaddrs function parses the data obtained from a call to the AcceptEx function and passes the local and remote addresses to a sockaddr structure.

Note  This function is a Microsoft-specific extension to the Windows Sockets specification.

 

Syntax

void GetAcceptExSockaddrs(
  [in]  PVOID    lpOutputBuffer,
  [in]  DWORD    dwReceiveDataLength,
  [in]  DWORD    dwLocalAddressLength,
  [in]  DWORD    dwRemoteAddressLength,
  [out] sockaddr **LocalSockaddr,
  [out] LPINT    LocalSockaddrLength,
  [out] sockaddr **RemoteSockaddr,
  [out] LPINT    RemoteSockaddrLength
);

Parameters

[in] lpOutputBuffer

A pointer to a buffer that receives the first block of data sent on a connection resulting from an AcceptEx call. Must be the same lpOutputBuffer parameter that was passed to the AcceptEx function.

[in] dwReceiveDataLength

The number of bytes in the buffer used for receiving the first data. This value must be equal to the dwReceiveDataLength parameter that was passed to the AcceptEx function.

[in] dwLocalAddressLength

The number of bytes reserved for the local address information. This value must be equal to the dwLocalAddressLength parameter that was passed to the AcceptEx function.

[in] dwRemoteAddressLength

The number of bytes reserved for the remote address information. This value must be equal to the dwRemoteAddressLength parameter that was passed to the AcceptEx function.

[out] LocalSockaddr

A pointer to the sockaddr structure that receives the local address of the connection (the same information that would be returned by the getsockname function). This parameter must be specified.

[out] LocalSockaddrLength

The size, in bytes, of the local address. This parameter must be specified.

[out] RemoteSockaddr

A pointer to the sockaddr structure that receives the remote address of the connection (the same information that would be returned by the getpeername function). This parameter must be specified.

[out] RemoteSockaddrLength

The size, in bytes, of the local address. This parameter must be specified.

Return value

None

Remarks

The GetAcceptExSockaddrs function is used exclusively with the AcceptEx function to parse the first data that the socket receives into local and remote addresses. The AcceptEx function returns local and remote address information in an internal format. Application developers need to use the GetAcceptExSockaddrs function if there is a need for the sockaddr structures containing the local or remote addresses.

Note  The function pointer for the GetAcceptExSockaddrs function must be obtained at run time by making a call to the WSAIoctl function with the SIO_GET_EXTENSION_FUNCTION_POINTER opcode specified. The input buffer passed to the WSAIoctl function must contain WSAID_GETACCEPTEXSOCKADDRS, a globally unique identifier (GUID) whose value identifies the GetAcceptExSockaddrs extension function. On success, the output returned by the WSAIoctl function contains a pointer to the GetAcceptExSockaddrs function. The WSAID_GETACCEPTEXSOCKADDRS GUID is defined in the Mswsock.h header file.
 

Windows Phone 8: This function is supported for Windows Phone Store apps on Windows Phone 8 and later.

Windows 8.1 and Windows Server 2012 R2: This function is supported for Windows Store apps on Windows 8.1, Windows Server 2012 R2, and later.

Requirements

Requirement Value
Minimum supported client Windows 8.1, Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 [desktop apps | UWP apps]
Target Platform Windows
Header mswsock.h (include Mswsock.h)
Library Mswsock.lib
DLL Mswsock.dll

See also

AcceptEx

Winsock Functions

Winsock Reference

getpeername

getsockname

sockaddr