WSHStringToAddress

INT
   WSHStringToAddress(
       IN LPWSTR 
AddressString,
       IN DWORD  AddressFamily,
       IN LPWSAPROTOCOL_INFOW  ProtocolInfo  OPTIONAL,
       OUT LPSOCKADDR  Address,
       IN OUT LPDWORD  AddressStringLength
       );

WSHStringToAddress converts a logical string representation of a socket address into a SOCKADDR structure.

Parameters

AddressString

Points to a buffer containing the logical string representation of a socket address.

AddressFamily

Specifies the address family that AddressString belongs to.

Protocol Info

Points to a structure that contains protocol information or is NULL.

Address

Points to a buffer in which WSHStringToAddress returns the completed SOCKADDR structure that the AddressString represented.

AddressStringLength

On input, points to a variable containing the size of bytes of the buffer provided at Address. WSHStringToAddress resets the value to the number of bytes actually copied into Address.

Return Value

WSHStringToAddress returns zero if the function successfuly translated the given string into a SOCKADDR structure. Otherwise, WSHStringToAddress returns one of the following:

WSAEFAULT

The buffer provided at Address is too small to hold the translated SOCKADDR structure.

WSAEINVAL

The function was given a string it was unable to translate into a SOCKADDR structure.

Comments

WSHStringToAddress should make a best-effort attempt to convert any missing components of the supplied address string. For example, a missing port number could be interpreted as being a zero for certain protocols. If WSHStringToAddress cannot make a reasonable translation of the string, it returns WSAEINVAL.

See Also

WSHAddressToString