WSAStringToAddress  1.S96UB

The Windows Sockets WSAStringToAddress function converts a human-readable string to a socket address structure (SOCKADDR) suitable to pass to Windows Sockets routines which take such a structure.

Any missing components of the address will be defaulted to a reasonable value, if possible. For example, a missing port number will default to zero. 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 WSAStringToAddress(

    LPTSTR AddressString,

 

    INT AddressFamily,

 

    LPWSAPROTOCOL_INFO lpProtocolInfo,

 

    LPSOCKADDR lpAddress,

 

    LPINT lpAddressLength

 

   );

 

 

Parameters

AddressString

[in] Points to the zero-terminated human-readable string to convert.

AddressFamily

[in] The address family to which the string belongs.

lpProtocolInfo

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

Address

[in/out] A buffer which is filled with a single SOCKADDR structure.

lpAddressLength

[in/out] The length of the Address buffer. Returns the size of the resultant SOCKADDR structure.

 

Return Values

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

Error Codes

WSAEFAULT

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

WSAEINVAL

Unable to translate the string into a SOCKADDR.