Compartir a través de


WSHGetSockaddrType function

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

The WSHGetSockaddrType function parses a socket address and returns information about it to Windows Sockets.

Syntax

INT WSHGetSockaddrType(
  _In_  PSOCKADDR      Sockaddr,
  _In_  DWORD          SockaddrLength,
  _Out_ PSOCKADDR_INFO SockaddrInfo
);

Parameters

  • Sockaddr [in]
    Pointer to the SOCKADDR structure to be evaluated.

  • SockaddrLength [in]
    Specifies the length, in bytes, of the structure at Sockaddr.

  • SockaddrInfo [out]
    Pointer to a buffer in which the helper DLL returns information about the socket address, formatted as a SOCKADDR_INFO structure.

Return value

WSHGetSockaddrType returns zero if the given socket address is valid for the address family supported by this helper DLL. Otherwise, it returns a Windows Sockets error code.

Remarks

Windows Sockets calls WSHGetSockaddrType when it needs information about a SOCKADDR. The helper DLL evaluates both the machine address and endpoint portions of the SOCKADDR. The machine-address portion specifies a particular machine, for example, the IP address in an internet address. The endpoint specifies a particular service on a machine, corresponding to the port number in an internet address.

The SOCKADDR_INFO structure is defined as follows:

typedef struct _SOCKADDR_INFO {
    SOCKADDR_ADDRESS_INFO AddressInfo;
    SOCKADDR_ENDPOINT_INFO EndpointInfo;
} SOCKADDR_INFO, *PSOCKADDR_INFO;

SOCKADDR_ADDRESS_INFO is an enumerated type, with the following possible values:

  • SockaddrAddressInfoNormal
    The address portion of the SOCKADDR has no unusual characteristics.

  • SockaddrAddressInfoWildcard
    The address portion of the SOCKADDR is a "wildcard," meaning that it does not specify a particular address. For example, this corresponds to INADDR_ANY (0.0.0.0) for IP addresses, which an application passes to bind when it has no particular requirements for the IP address used for a socket.

    Note   Beginning with Windows Vista, the wildcard IP address 0.0.0.0 is not available.

    Also beginning with Windows Vista, if the IPAutoconfigurationEnabled registry key is set to a value of 0, automatic IP address assignment is disabled, and no IP address is assigned. In this case, the ipconfig command line tool will not display an IP address. If the key is set to a nonzero value, an IP address is automatically assigned. This key can be located at the following paths in the registry:

    HKEY_LOCAL_MACHINE\SYSTEM\Current Control Set\Services\Tcpip\Parameters\IPAutoconfigurationEnabled

    HKEY_LOCAL_MACHINE\SYSTEM\Current Control Set\Services\Tcpip\Parameters\Interfaces\GUID\IPAutoconfigurationEnabled

     

  • SockaddrAddressInfoBroadcast
    The address portion of the SOCKADDR refers to the address family's broadcast address. For example, in IP addresses, this is INADDR_BROADCAST (255.255.255.255).

  • SockaddrAddressInfoLoopback
    The address portion of the SOCKADDR refers to the address family's loopback address. For example, in internet addresses, this is INADDR_LOOPBACK (127.0.0.1).

SOCKADDR_ENDPOINT_INFO also is an enumerated type, with the following possible values:

  • SockaddrEndpointInfoNormal
    The endpoint portion of the SOCKADDR has no unusual characteristics.

  • SockaddrEndpointInfoWildcard
    The endpoint portion of the SOCKADDR is a wildcard, meaning that it could refer to any endpoint. An application, typically a client, can pass a wildcard endpoint to bind when it has no particular requirements for the endpoint assigned. For example, in IP addresses, a port set to zero is a wildcard endpoint.

  • SockaddrEndpointInfoReserved
    The endpoint of the SOCKADDR is reserved, meaning that special privilege is required to bind to it. For example, in internet addresses, a port with a value less than IPPORT_RESERVED (1024) is a reserved endpoint.

Requirements

Target platform

Desktop

Header

Wsahelp.h (include Wsahelp.h)

Library

Wshisotp.lib

 

 

Send comments about this topic to Microsoft