WSAAddressToString  6AA8_7N

The Windows Sockets WSAAddressToString function converts all components of a SOCKADDR structure into a human-readable string representation of the address.

This is intended to be used mainly for display purposes. If the caller wants the translation to be done by a particular provider, it should supply the corresponding WSAPROTOCOL_INFO structure in the lpProtocolInfo parameter.

INT WSAAddressToString(

    LPSOCKADDR lpsaAddress,

 

    DWORD dwAddressLength,

 

    LPWSAPROTOCOL_INFO lpProtocolInfo,

 

    OUT LPTSTR lpszAddressString,

 

    OUT LPDWORD lpdwAddressStringLength

 

   );

 

 

Parameters

lpsaAddress

[in] Points to a SOCKADDR structure to translate into a string.

dwAddressLength

[in] The length of the Address SOCKADDR.

lpProtocolInfo

[in] (Optional) The WSAPROTOCOL_INFO structure for a particular provider.

lpszAddressString

[in] A buffer which receives the human-readable address string.

lpdwAddressStringLength

[in] On input, the length of the AddressString buffer. On output, returns the length ofthe string actually copied into the buffer.

 

Return Values

The return value is zero if the operation was successful. Otherwise, the value SOCKET_ERROR is returned, and a specific error number can be retrieved by calling WSAGetLastError.

Error Codes

WSAEFAULT

The specified AddressString buffer is too small. Pass in a larger buffer

WSAEINVAL

The specified address is not a valid socket address.