Share via


WSHStringToAddress function

[ This function is obsolete for Windows Server 2003, Windows Vista, and later, and is no longer supported. ]

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

Syntax

INT WSHStringToAddress(
  _In_     LPWSTR              AddressString,
  _In_     DWORD               AddressFamily,
  _In_opt_ LPWSAPROTOCOL_INFOW ProtocolInfo,
  _Out_    LPSOCKADDR          Address,
  _Inout_  LPDWORD             AddressStringLength
);

Parameters

  • AddressString [in]
    Pointer to a buffer containing the logical string representation of a socket address.

  • AddressFamily [in]
    Specifies the address family that AddressString belongs to.

  • ProtocolInfo [in, optional]
    Pointer to a structure that contains protocol information or is NULL.

  • Address [out]
    Pointer to a buffer in which WSHStringToAddress returns the completed SOCKADDR structure that the AddressString represented.

  • AddressStringLength [in, out]
    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:

Return code Description
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.

 

Remarks

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.

Requirements

Target platform

Desktop

Header

Wsahelp.h (include Wsahelp.h)

See also

WSHAddressToString

 

 

Send comments about this topic to Microsoft