共用方式為


WSADATA

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This structure is used to store Windows Sockets initialization data returned by a call to WSAStartup.

Syntax

typedef struct WSAData {
  WORD wVersion;
  WORD wHighVersion;
  char szDescription[WSADESCRIPTION_LEN+1];
  char szSystemStatus[WSASYS_STATUS_LEN+1];
  unsigned short iMaxSockets;
  unsigned short iMaxUdpDg;
  char FAR* lpVendorInfo;
} WSADATA, *LPWSADATA; 

Members

  • wVersion
    Version of the Windows Sockets Specificationthat the Ws2_32.dll expects the caller to use.
  • wHighVersion
    Highest version of the Windows Sockets Specification that this DLL can support (also encoded as above). Typically, this is the same as wVersion.
  • szDescription
    Null-terminated ASCII string into which the Ws2_32.dll copies a description of the Windows Sockets implementation. The text (up to 256 characters in length) can contain any characters except control and formatting characters. The most likely use that an application can put this to is to display it (possibly truncated) in a status message.
  • szSystemStatus
    Null-terminated ASCII string into which the WSs2_32.dll copies relevant status or configuration information. The Ws2_32.dll should use this parameter only if the information might be useful to the user or support staff. It should not be considered as an extension of the szDescription parameter.
  • iMaxSockets
    Retained for backward compatibility, but should be ignored for Winsock 2.0 and later, as no single value can be appropriate for all underlying service providers.
  • iMaxUdpDg
    Ignored for Winsock 2.0 and later. This member is retained for compatibility with Winsock 1.1, but should not be used when developing new applications. For the actual maximum message size specific to a particular Windows Sockets service provider and socket type, applications should use getsockopt (Windows Sockets) to retrieve the value of option SO_MAX_MSG_SIZE after a socket has been created.
  • lpVendorInfo
    Ignored for Winsock 2.0 and later. It is retained for compatibility with Winsock 1.1. Applications needing to access vendor-specific configuration information should use getsockopt (Windows Sockets) to retrieve the value of option PVD_CONFIG. The definition of this value is beyond the scope of this specification.

Remarks

If, after a successful call to WSAStartup, the value in wVersion is at least 2, an application should ignore the iMaxsockets, iMaxUdpDg, and lpVendorInfo members. This is because Winsock 2.2 supports multiple providers, and WSAData no longer applies to a single vendor stack. Two new socket options, SO_MAX_MSG_SIZE and PVD_CONFIG supply provider-specific information. SO_MAX_MSG_SIZE replaces iMaxUdpDg, and PVD_CONFIG allows configuration of other provider-specific information.

Requirements

Header winsock2.h
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

getsockopt (Windows Sockets)
WSAStartup