0% found this document useful (0 votes)
3K views

Win Sock

This document summarizes the sections and key concepts in the Winsock reference. It describes the different sections that are covered, such as socket options, IOCTLs, and error codes. It provides examples of some common socket options and IOCTLs to give an overview of what is contained in the reference.

Uploaded by

om18sahu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3K views

Win Sock

This document summarizes the sections and key concepts in the Winsock reference. It describes the different sections that are covered, such as socket options, IOCTLs, and error codes. It provides examples of some common socket options and IOCTLs to give an overview of what is contained in the reference.

Uploaded by

om18sahu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 35

Winsock reference is divided into the following sections:

* Socket Options
* Winsock IOCTLs
* Winsock Annexes
* Winsock Enumerations
* Winsock Functions
* Winsock Structures
* Winsock SPI
* Windows Sockets Error Codes

Socket Options

This section describes Winsock Socket Options for various editions of Windows
operating systems. Use the getsockopt and setsockopt functions for more getting
and setting socket options. To enumerate protocols and discover supported
properties for each installed protocol, use the WSAEnumProtocols function.

Some socket options require more explanation than these tables can convey; such
options contain links to additional pages.

IPPROTO_IP

Socket options applicable at the IPv4 level. For more information, see the
IPPROTO_IP Socket Options.
IPPROTO_IPV6

Socket options applicable at the IPv6 level. For more information, see the
IPPROTO_IPV6 Socket Options.
IPPROTO_RM

Socket options applicable at the reliable multicast level. For more


information, see the IPPROTO_RM Socket Options.
IPPROTO_TCP

Socket options applicable at the TCP level. For more information, see the
IPPROTO_TCP Socket Options.
IPPROTO_UDP

Socket options applicable at the UDP level. For more information, see the
IPPROTO_UDP Socket Options.
NSPROTO_IPX

Socket options applicable at the IPX level. For more information, see the
NSPROTO_IPX Socket Options.
SOL_APPLETALK

Socket options applicable at the AppleTalk level. For more information, see
the SOL_APPLETALK Socket Options.
SOL_IRLMP

Socket options applicable at the InfraRed Link Management Protocol level. For
more information, see the SOL_IRLMP Socket Options.
SOL_SOCKET

Socket options applicable at the socket level. For more information, see the
SOL_SOCKET Socket Options.
__________________________________________________________________________________
________

Winsock IOCTLs

This section describes Winsock Socket IOCTLs for various editions of Windows
operating systems. Use the WSAIoctl or WSPIoctl function to issue a Winsock IOCTL
to control the mode of a socket, the transport protocol, or the communications
subsystem.

Some Winsock IOCTLs require more explanation than this table can convey; such
options contain links to additional pages.

It is possible to adopt an encoding scheme that preserves the currently defined


ioctlsocket opcodes while providing a convenient way to partition the opcode
identifier space in as much as the dwIoControlCode parameter is now a 32-bit
entity. The dwIoControlCode parameter is built to allow for protocol and vendor
independence when adding new control codes while retaining backward compatibility
with the Windows Sockets 1.1 and Unix control codes. The dwIoControlCode parameter
has the following form.

I O V T Vendor/address family Code


3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0

Note The bits in dwIoControlCode parameter displayed in the table must be read
vertically from top to bottom by column. So the left-most bit is bit 31, the next
bit is bit 30, and the right-most bit is bit 0.

I is set if the input buffer is valid for the code, as with IOC_IN.

O is set if the output buffer is valid for the code, as with IOC_OUT. Control
codes using both input and output buffers set both I and O.

V is set if there are no parameters for the code, as with IOC_VOID.

T is a 2-bit quantity that defines the type of the IOCTL. The following values are
defined:

0 The IOCTL is a standard Unix IOCTL code, as with FIONREAD and FIONBIO.

1 The IOCTL is a generic Windows Sockets 2 IOCTL code. New IOCTL codes defined for
Windows Sockets 2 will have T == 1.

2 The IOCTL applies only to a specific address family.

3 The IOCTL applies only to a specific vendor's provider, as with IOC_VENDOR. This
type allows companies to be assigned a vendor number that appears in the
Vendor/Address family parameter. Then, the vendor can define new IOCTLs specific
to that vendor without having to register the IOCTL with a clearinghouse, thereby
providing vendor flexibility and privacy.

Vendor/Address family An 11-bit quantity that defines the vendor who owns the code
(if T == 3) or that contains the address family to which the code applies (if T ==
2). If this is a Unix IOCTL code (T == 0) then this parameter has the same value
as the code on Unix. If this is a generic Windows Sockets 2 IOCTL (T == 1) then
this parameter can be used as an extension of the code parameter to provide
additional code values.
Code The 16-bit quantity that contains the specific IOCTL code for the operation.

The following Unix IOCTL codes (commands) are supported.

FIONBIO

Enable or disable non-blocking mode on socket s. lpvInBuffer points at an


unsigned long (QOS), which is nonzero if non-blocking mode is to be enabled and
zero if it is to be disabled. When a socket is created, it operates in blocking
mode (that is, non-blocking mode is disabled). This is consistent with BSD
sockets.

The WSAAsyncSelect or WSAEventSelect routine automatically sets a socket


to non-blocking mode. If WSAAsyncSelect or WSAEventSelect has been issued on a
socket, then any attempt to use WSAIoctl to set the socket back to blocking mode
will fail with WSAEINVAL. To set the socket back to blocking mode, an application
must first disable WSAAsyncSelect by calling WSAAsyncSelect with the lEvent
parameter equal to zero, or disable WSAEventSelect by calling WSAEventSelect with
the lNetworkEvents parameter equal to zero.
FIONREAD

Determine the amount of data that can be read atomically from socket s.
lpvOutBuffer points at an unsigned long in which WSAIoctl stores the result. If s
is stream oriented (for example, type SOCK_STREAM), FIONREAD returns the total
amount of data that can be read in a single receive operation; this is normally
the same as the total amount of data queued on the socket (since data stream is
byte-oriented, this is not guaranteed). If s is message oriented (for example,
type SOCK_DGRAM), FIONREAD returns the size of the first datagram (message) queued
on the socket.
SIOCATMARK

Determine whether or not all OOB data has been read. This applies only to
a socket of stream-style (for example, type SOCK_STREAM) that has been configured
for inline reception of any OOB data (SO_OOBINLINE). If no OOB data is waiting to
be read, the operation returns TRUE. Otherwise, it returns FALSE, and the next
receive operation performed on the socket will retrieve some or all of the data
preceding the mark; the application should use the SIOCATMARK operation to
determine whether any remains. If there is any normal data preceding the urgent
(out of band) data, it will be received in order. (Note that recv operations will
never mix OOB and normal data in the same call.) lpvOutBuffer points at a BOOL in
which WSAIoctl stores the result.

The following Windows Sockets 2 commands are supported.

SIO_ADDRESS_LIST_CHANGE (opcode setting: V, T==1)

To receive notification of changes in the list of local transport


addresses of the socket's protocol family to which the application can bind. No
output information will be provided upon completion of this IOCTL; the completion
merely indicates that list of available local address has changed and should be
queried again through SIO_ADDRESS_LIST_QUERY.

It is assumed (although not required) that the application uses overlapped


I/O to be notified of change by completion of SIO_ADDRESS_LIST_CHANGE request.
Alternatively, if the SIO_ADDRESS_LIST_CHANGE IOCTL is issued on a non-blocking
socket and without overlapped parameters (lpOverlapped/ lpCompletionRoutine are
set to NULL), it will complete immediately with error WSAEWOULDBLOCK. The
application can then wait for address list change events through a call to
WSAEventSelect or WSAAsyncSelect with FD_ADDRESS_LIST_CHANGE bit set in the
network event bitmask.
SIO_ADDRESS_LIST_QUERY (opcode setting: I, O, T==1)

Obtains a list of local transport addresses of the socket's protocol


family to which the application can bind. The list of addresses varies based on
address family. For address family AF_INET, all addresses are returned, except
addresses on the MS Loopback interface. For address family AF_INET6, all addresses
are returned. The list returned in the output buffer using the following format:

Copy Code

typedef struct _SOCKET_ADDRESS_LIST {


INT iAddressCount;
SOCKET_ADDRESS Address[1];
} SOCKET_ADDRESS_LIST, FAR * LPSOCKET_ADDRESS_LIST;
Members:
iAddressCount - number of address structures in the list;
Address - array of protocol family specific address structures.

Note In Windows Plug-n-Play environments, addresses can be added and


removed dynamically. Therefore, applications cannot rely on the information
returned by SIO_ADDRESS_LIST_QUERY to be persistent. Applications may register for
address change notifications through the SIO_ADDRESS_LIST_CHANGE IOCTL which
provides for notification through either overlapped I/O or FD_ADDRESS_LIST_CHANGE
event. The following sequence of actions can be used to guarantee that the
application always has current address list information:

* Issue SIO_ADDRESS_LIST_CHANGE IOCTL


* Issue SIO_ADDRESS_LIST_QUERY IOCTL
* Whenever SIO_ADDRESS_LIST_CHANGE IOCTL notifies the application of
address list change (either through overlapped I/O or by signaling
FD_ADDRESS_LIST_CHANGE event), the whole sequence of actions should be repeated.

Note If the output buffer is not large enough to contain the address
list, SOCKET_ERROR is returned as the result of this IOCTL and WSAGetLastError
returns WSAEFAULT. The required size, in bytes, for the output buffer is returned
in the lpcbBytesReturned parameter in this case. Note the WSAEFAULT error code is
also returned if the lpvInBuffer, lpvOutBuffer, or lpcbBytesReturned parameter is
not completely contained in a valid part of the user address space.
SIO_ASSOCIATE_HANDLE (opcode setting: I, T==1)

Associate this socket with the specified handle of a companion interface.


The input buffer contains the integer value corresponding to the manifest constant
for the companion interface (for example, TH_NETDEV and TH_TAPI.), followed by a
value that is a handle of the specified companion interface, along with any other
required information. Refer to the appropriate section in Winsock Annexes for
details specific to a particular companion interface. The total size is reflected
in the input buffer length. No output buffer is required. The WSAENOPROTOOPT error
code is indicated for service providers that do not support this IOCTL. The handle
associated by this IOCTL can be retrieved using SIO_TRANSLATE_HANDLE.

A companion interface might be used, for example, if a particular provider


provides (1) a great deal of additional controls over the behavior of a socket and
(2) the controls are provider-specific enough that they do not map to existing
Windows Socket functions or ones likely to be defined in the future. It is
recommend that the Component Object Model (COM) be used instead of this IOCTL to
discover and track other interfaces that might be supported by a socket. This
IOCTL is present for (reverse) compatibility with systems where COM is not
available or cannot be used for some other reason.
SIO_BASE_HANDLE (opcode setting: O, T==1)

Retrieves the base service provider handle for a given socket. The
returned value is a SOCKET.

A layered service provider would never intercept this IOCTL since the
return value must be the socket handle from the base service provider.

If the output buffer is not large enough for a socket handle (the
cbOutBuffer is less than the size of a SOCKET) or the lpvOutBuffer parameter is a
NULL pointer, SOCKET_ERROR is returned as the result of this IOCTL and
WSAGetLastError returns WSAEFAULT.

SIO_BASE_HANDLE is defined in the Mswsock.h header file and supported on


Windows Vista and later.
SIO_BSP_HANDLE (opcode setting: O, T==1)

Retrieves the base service provider handle for a socket used by the
WSASendMsg function. The returned value is a SOCKET.

This Ioctl is used by a layered service provider to ensure the provider


intercept the WSASendMsg function.

If the output buffer is not large enough for a socket handle (the
cbOutBuffer is less than the size of a SOCKET) or the lpvOutBuffer parameter is a
NULL pointer, SOCKET_ERROR is returned as the result of this IOCTL and
WSAGetLastError returns WSAEFAULT.

SIO_BSP_HANDLE is defined in the Mswsock.h header file and supported on


Windows Vista and later.
SIO_BSP_HANDLE_SELECT (opcode setting: O, T==1)

Retrieves the base service provider handle for a socket used by the select
function. The returned value is a SOCKET.

This Ioctl is used by a layered service provider to ensure the provider


intercept the select function.

If the output buffer is not large enough for a socket handle (the
cbOutBuffer is less than the size of a SOCKET) or the lpvOutBuffer parameter is a
NULL pointer, SOCKET_ERROR is returned as the result of this IOCTL and
WSAGetLastError returns WSAEFAULT.

SIO_BSP_HANDLE_SELECT is defined in the Mswsock.h header file and


supported on Windows Vista and later.
SIO_BSP_HANDLE_POLL (opcode setting: O, T==1)

Retrieves the base service provider handle for a socket used by the
WSAPoll function. The lpOverlapped parameter must be a NULL pointer. The returned
value is a SOCKET.

This Ioctl is used by a layered service provider to ensure the provider


intercept the WSAPoll function.

If the output buffer is not large enough for a socket handle (the
cbOutBuffer is less than the size of a SOCKET), the lpvOutBuffer parameter is a
NULL pointer, or the lpOverlapped parameter is not a NULL pointer, SOCKET_ERROR is
returned as the result of this IOCTL and WSAGetLastError returns WSAEFAULT.

SIO_BSP_HANDLE_POLL is defined in the Mswsock.h header file and supported


on Windows Vista and later.
SIO_CHK_QOS (opcode setting: I, O, T==3)

Retrieves information about QOS traffic characteristics. During the


transitional phase on the sending system between flow setup and the receipt of a
RESV message (see How the RSVP Service Invokes TC for more information on the
transitional phase), traffic associated with an RSVP flow is shaped based on
service type ( BEST EFFORT, CONTROLLED LOAD, or GUARANTEED). For more information,
see Using SIO_CHK_QOS in the Quality of Service section of the Platform SDK.
SIO_ENABLE_CIRCULAR_QUEUEING (opcode setting: V, T==1)

Indicates to the underlying message-oriented service provider that a newly


arrived message should never be dropped because of a buffer queue overflow.
Instead, the oldest message in the queue should be eliminated in order to
accommodate the newly arrived message. No input and output buffers are required.
Note that this IOCTL is only valid for sockets associated with unreliable,
message-oriented protocols. The WSAENOPROTOOPT error code is indicated for service
providers that do not support this IOCTL.
SIO_FIND_ROUTE (opcode setting: O, T==1)

When issued, this IOCTL requests that the route to the remote address
specified as a sockaddr in the input buffer be discovered. If the address already
exists in the local cache, its entry is invalidated. In the case of Novell's IPX,
this call initiates an IPX GetLocalTarget (GLT), which queries the network for the
given remote address.
SIO_FLUSH (opcode setting: V, T==1)

Discards current contents of the sending queue associated with this


socket. No input and output buffers are required. The WSAENOPROTOOPT error code is
indicated for service providers that do not support this IOCTL.
SIO_GET_BROADCAST_ADDRESS (opcode setting: O, T==1)

This IOCTL fills the output buffer with a sockaddr structure containing a
suitable broadcast address for use with sendto/ WSASendTo. This IOCTL is not
supported for IPv6 sockets and returns the WSAENOPROTOOPT error code.
SIO_GET_EXTENSION_FUNCTION_POINTER (opcode setting: O, I, T==1)

Retrieve a pointer to the specified extension function supported by the


associated service provider. The input buffer contains a globally unique
identifier (GUID) whose value identifies the extension function in question. The
pointer to the desired function is returned in the output buffer. Extension
function identifiers are established by service provider vendors and should be
included in vendor documentation that describes extension function capabilities
and semantics.

The GUID values for extension functions supported by the Windows TCP/IP
service provider are defined in the Mswsock.h header file. The possible value for
these GUIDs are as follows:

Term Description

WSAID_ACCEPTEX
The AcceptEx extension function.

WSAID_CONNECTEX

The ConnectEx extension function.

WSAID_DISCONNECTEX

The DisconnectEx extension function.

WSAID_GETACCEPTEXSOCKADDRS

The GetAcceptExSockaddrs extension function.

WSAID_TRANSMITFILE

The TransmitFile extension function.

WSAID_TRANSMITPACKETS

The TransmitPackets extension function.

WSAID_WSARECVMSG

The WSARecvMsg extension function.

WSAID_WSASENDMSG

The WSASendMsg extension function.


SIO_GET_GROUP_QOS (opcode setting: O, I, T==1)

Reserved for future use with sockets.

Retrieve the QOS structure associated with the socket group to which this
socket belongs. The input buffer is optional. Some protocols (for example, RSVP)
allow the input buffer to be used to qualify a quality of service request. The QOS
structure will be copied into the output buffer. If this socket does not belong to
an appropriate socket group, the SendingFlowspec and ReceivingFlowspec members of
the returned QOS structure are set to NULL. The WSAENOPROTOOPT error code is
indicated for service providers that do not support quality of service.
SIO_GET_INTERFACE_LIST (opcode setting: O, T==0)

Returns a list of configured IP interfaces and their parameters as an


array of INTERFACE_INFO structures.

Note Support of this command is mandatory for Windows Sockets 2-compliant


TCP/IP service providers.

The lpvOutBuffer parameter points to the buffer in which to store the


information about interfaces as an array of INTERFACE_INFO structures for unicast
IP addresses on the interfaces. The cbOutBuffer parameter specifies the length of
the output buffer. The number of interfaces returned (number of structures
returned in the buffer pointed to by lpvOutBuffer parameter) can be determined
based on the actual length of the output buffer returned in lpcbBytesReturned
parameter.

If the WSAIoctl function is called with SIO_GET_INTERFACE_LIST and the


level member of the socket s parameter is not defined as IPPROTO_IP, WSAEINVAL is
returned. A call to the WSAIoctl function with SIO_GET_INTERFACE_LIST returns
WSAEFAULT if the cbOutBuffer parameter that specifies the length of the output
buffer is too small ro receive the list of configured interfaces.

SIO_GET_INTERFACE_LIST is supported on Windows Me/98 and Windows NT 4.0


SP4 and later.
SIO_GET_INTERFACE_LIST_EX (opcode setting: O, T==0)

Reserved for future use with sockets.

Returns a list of configured IP interfaces and their parameters as an


array of INTERFACE_INFO_EX structures.

The lpvOutBuffer parameter points to the buffer in which to store the


information about interfaces as an array of INTERFACE_INFO_EX structures for
unicast IP addresses on the interface. The cbOutBuffer parameter specifies the
length of the output buffer. The number of interfaces returned (number of
structures returned in lpvOutBuffer) can be determined based on the actual length
of the output buffer returned in lpcbBytesReturned parameter.

SIO_GET_INTERFACE_LIST_EX is not currently supported on Windows.


SIO_GET_QOS (opcode setting: O, T==1)

Reserved for future use with sockets. Retrieve the QOS structure
associated with the socket. The input buffer is optional. Some protocols (for
example, RSVP) allow the input buffer to be used to qualify a quality of service
request. The QOS structure will be copied into the output buffer. The output
buffer must be sized large enough to be able to contain the full QOS structure.
The WSAENOPROTOOPT error code is indicated for service providers that do not
support quality of service.

A sender may not call SIO_GET_QOS until the socket is connected.

A receiver may call SIO_GET_QOS as soon as it is bound.


SIO_IDEAL_SEND_BACKLOG_CHANGE (opcode setting: V, T==0)

Notifies an application when the ideal send backlog (ISB) value changes
for the underlying connection.

When sending data over a TCP connection using Windows sockets, it is


important to keep a sufficient amount of data outstanding (sent but not
acknowledged yet) in TCP in order to achieve the highest throughput. The ideal
value for the amount of data outstanding to achieve the best throughput for the
TCP connection is called the ideal send backlog (ISB) size. The ISB value is a
function of the bandwidth-delay product of the TCP connection and the receiver's
advertised receive window (and partly the amount of congestion in the network).

The ISB value per connection is available from the TCP protocol
implementation in Windows Server 2008, Windows Vista SP1, and later versions of
the operating system. The SIO_IDEAL_SEND_BACKLOG_CHANGE IOCTL can be used by an
application to get notification when the ISB value changes dynamically for a
connection.

For more detailed information, see the SIO_IDEAL_SEND_BACKLOG_CHANGE


reference.

SIO_IDEAL_SEND_BACKLOG_CHANGE is supported on Windows Server 2008, Windows


Vista SP1, and later versions of the operating system.
SIO_IDEAL_SEND_BACKLOG_QUERY (opcode setting: O, T==0)

Retrieves the ideal send backlog (ISB) value for the underlying
connection.

When sending data over a TCP connection using Windows sockets, it is


important to keep a sufficient amount of data outstanding (sent but not
acknowledged yet) in TCP in order to achieve the highest throughput. The ideal
value for the amount of data outstanding to achieve the best throughput for the
TCP connection is called the ideal send backlog (ISB) size. The ISB value is a
function of the bandwidth-delay product of the TCP connection and the receiver's
advertised receive window (and partly the amount of congestion in the network).

The ISB value per connection is available from the TCP protocol
implementation in Windows Server 2008 and later. The SIO_IDEAL_SEND_BACKLOG_QUERY
IOCTL can be used by an application to query the ISB value for a connection.

For more detailed information, see the SIO_IDEAL_SEND_BACKLOG_QUERY


reference.

SIO_IDEAL_SEND_BACKLOG_QUERY is supported on Windows Server 2008, Windows


Vista SP1, and later versions of the operating system.
SIO_KEEPALIVE_VALS (opcode setting: I, T==3)

Enables or disables the per-connection setting of the TCP keep-alive


option which specifies the TCP keep-alive timeout and interval. For more
information on the keep-alive option, see section 4.2.3.6 on the Requirements for
Internet Hosts�Communication Layers specified in RFC 1122 available at the IETF
website. The argument structure for SIO_KEEPALIVE_VALS is specified in the
tcp_keepalive structure defined in the Mstcpip.h header file. This structure is
defined as follows:

Copy Code

/* Argument structure for SIO_KEEPALIVE_VALS */


struct tcp_keepalive {
u_long onoff;
u_long keepalivetime;
u_long keepaliveinterval;
};

The value specified in the onoff member determines if TCP keep-alive is


enabled or disabled. If the onoff member is set to a non-zero value, TCP keep-
alive is enabled and the other members in the structure are used. The
keepalivetime member specifies the timeout, in milliseconds, with no activity
until the first keep-alive packet is sent. The keepaliveinterval member specifies
the interval, in milliseconds, between when successive keep-alive packets are sent
if no acknowledgement is received.

The SO_KEEPALIVE option, which is one of the SOL_SOCKET Socket Options,


can also be used to enable or disable the TCP keep-alive on a connection, as well
as query the current state of this option. To query whether TCP keep-alive is
enabled on a socket, the getsockopt function can be called with the SO_KEEPALIVE
option. To enable or disable TCP keep-alive, the setsockopt function can be called
with the SO_KEEPALIVE option. If TCP keep-alive is enabled with SO_KEEPALIVE, then
the default TCP settings are used for keep-alive timeout and interval unless these
values have been changed using SIO_KEEPALIVE_VALS. The default settings when a TCP
socket is initialized sets the keep-alive timeout to 2 hours and the keep-alive
interval to 1 second. The number of keep-alive probes cannot be changed and is set
to 10.

SIO_KEEPALIVE_VALS is supported on Windows 2000 and later.


SIO_MULTIPOINT_LOOPBACK (opcode setting: V, T==1)

Controls whether data sent in a multipoint session will also be received


by the same socket on the local host. A value of TRUE causes loopback reception to
occur while a value of FALSE prohibits this. By default, loopback is enabled.
SIO_MULTICAST_SCOPE (opcode setting: I, T==1)

Specifies the scope over which multicast transmissions will occur. Scope
is defined as the number of routed network segments to be covered. A scope of zero
would indicate that the multicast transmission would not be placed on the wire but
could be disseminated across sockets within the local host. A scope value of one
(the default) indicates that the transmission will be placed on the wire, but will
not cross any routers. Higher scope values determine the number of routers that
can be crossed. Note that this corresponds to the time-to-live (TTL) parameter in
IP multicasting. By default, scope is 1.
SIO_QUERY_RSS_SCALABILITY_INFO (opcode setting: O, T==3)

Queries offload interfaces for receive-side scaling (RSS) capability. The


argument structure returned for SIO_QUERY_RSS_SCALABILITY_INFO is specified in the
RSS_SCALABILITY_INFO structure defined in the Mstcpip.h header file. This
structure is defined as follows:

Copy Code

// Scalability info for the transport


typedef struct _RSS_SCALABILITY_INFO {
BOOLEAN RssEnabled;
} RSS_SCALABILITY_INFO, *PRSS_SCALABILITY_INFO;

The value returned in the RssEnabled member indicates if RSS is enabled on


at least one interface.

If the output buffer is not large enough for the RSS_SCALABILITY_INFO


structure (the cbOutBuffer is less than the size of a RSS_SCALABILITY_INFO) or the
lpvOutBuffer parameter is a NULL pointer, SOCKET_ERROR is returned as the result
of this IOCTL and WSAGetLastError returns WSAEINVAL.

In high-speed networking where multiple CPUs reside within a single


system, the ability of the networking protocol stack to scale well on a multi-CPU
system is inhibited because the architecture of NDIS 5.1 and earlier versions
limits receive protocol processing to a single CPU. Receive-side scaling (RSS)
resolves this issue by allowing the network load from a network adapter to be
balanced across multiple CPUs.

SIO_QUERY_RSS_SCALABILITY_INFO is supported on Windows Vista and later.


SIO_QUERY_WFP_ALE_ENDPOINT_HANDLE (opcode setting: O, T==3)
Queries the Application Layer Enforcement (ALE) endpoint handle.

The Windows Filtering Platform (WFP) supports network traffic inspection


and modification. On Windows Vista, WFP focuses on scenarios where the host
machine is the communication endpoint. On Windows Server 2008 , however, there are
edge firewall implementations which would like to leverage the WFP platform to
inspect and proxy pass-through traffic. The Internet Security and Acceleration
(ISA) server is an example of such an edge device.

There are some firewall scenarios that may require the ability to inject
an inbound packet into the send path associated with an existing endpoint. There
needs to be a mechanism to discover the transport layer endpoint handle associated
with the destination endpoint. The application that created the endpoint owns
these transport layer endpoints. This IOCTL is used to provide socket handle to
transport layer endpoint handle mapping.

If the output buffer is not large enough for the endpoint handle (the
cbOutBuffer is less than the size of a UINT64) or the lpvOutBuffer parameter is a
NULL pointer, SOCKET_ERROR is returned as the result of this IOCTL and
WSAGetLastError returns WSAEINVAL.

SIO_QUERY_WFP_ALE_ENDPOINT_HANDLE is supported on Windows Vista and later.


SIO_RCVALL (opcode setting: I, T==3)

Enables a socket to receive all IPv4 or IPv6 packets on the network. The
socket handle passed to the WSAIoctl function must be one of the following:

* An IPv4 socket that was created with the address family set to
AF_INET, the socket type set to SOCK_RAW, and the protocol set to IPPROTO_IP.
* An IPv6 socket that was created with the address family set to
AF_INET6, the socket type set to SOCK_RAW, and the protocol set to IPPROTO_IPV6.

The socket also must be bound to an explicit local IPv4 or IPv6 interface,
which means that you cannot bind to INADDR_ANY.

Once the socket is bound and the IOCTL completes successfully, calls to
the WSARecv or recv functions return IPv4 datagrams passing through the given IPv4
interface or return IPv6 datagrams passing through the given IPv6 interface. Note
that you must supply a sufficiently large buffer. Setting this IOCTL will only
capture IPv4 or IPv6 packets on a given interface. This IOCTL will not capture
other packets (ARP, IPX, and NetBEUI packets, for example) on the interface.

Setting this IOCTL requires Administrator privilege on the local computer.

This feature is sometimes referred to as promiscuous mode. Any direct


change from applying this option on one interface and then to another interface
with a single call using this IOCTL is not supported . An application must first
use this IOCTL to turn off the behavior on the first interface, and then use this
IOCTL to enable the behavior on a new interface.

The possible values for the SIO_RCVALL IOCTL option are specified in the
RCVALL_VALUE enumeration defined in the Mstcpip.h header file. The possible values
for SIO_RCVALL are as follows:

Term Description

RCVALL_OFF
Disable this option so a socket does not receive all IPv4 or IPv6 packets
on the network.

RCVALL_ON

Enable this option so a socket receives all IPv4 or IPv6 packets on the
network. This option enables promiscuous mode on the network interface card (NIC),
if the NIC supports promiscuous mode. On a LAN segment with a network hub, a NIC
that supports promiscuous mode will capture all IPv4 or IPv6 traffic on the LAN,
including traffic between other computers on the same LAN segment. All of the
captured packets (IPv4 or IPv6, depending on the socket) will be delivered to the
raw socket.

This option will not capture other packets (ARP, IPX, and NetBEUI packets,
for example) on the interface.

Netmon uses the same mode for the network interface, but does not use this
option to capture traffic.

RCVALL_SOCKETLEVELONLY

This feature is not currently implemented, so setting this option does not
have any affect.

RCVALL_IPLEVEL

Enable this option so an IPv4 or IPv6 socket receives all packets at the
IP level on the network. This option does not enable promiscuous mode on the
network interface card. This option only affects packet processing at the IP
level. The NIC still receives only packets directed to its configured unicast and
multicast addresses. However, a socket with this option enabled will receive not
only packets directed to specific IP addresses, but will receive all the IPv4 or
IPv6 packets the NIC receives.

This option will not capture other packets (ARP, IPX, and NetBEUI packets,
for example) received on the interface.

SIO_RCVALL is supported on Windows 2000 and later.


SIO_RCVALL_IGMPMCAST (opcode setting: I, T==3)

Enables a socket to receive all IGMP multicast IP traffic on the network,


without receiving other multicast IP traffic. The socket handle passed to the
WSAIoctl function must be of AF_INET address family, SOCK_RAW socket type, and
IPPROTO_IGMP protocol. The socket also must be bound to an explicit local
interface, which means that you cannot bind to INADDR_ANY.

Once the socket is bound and the IOCTL set, calls to the WSARecv or recv
functions return multicast IP datagrams passing through the given interface. Note
that you must supply a sufficiently large buffer. Setting this IOCTL requires
Administrator privilege on the local computer.

SIO_RCVALL_IGMPMCAST is supported on Windows 2000 and later.


SIO_RCVALL_MCAST (opcode setting: I, T==3)
Enables a socket to receive all multicast IP traffic on the network (that
is, all IP packets destined for IP addresses in the range of 224.0.0.0 to
239.255.255.255). The socket handle passed to the WSAIoctl function must be of
AF_INET address family, SOCK_RAW socket type, and IPPROTO_UDP protocol. The socket
also must bind to an explicit local interface, which means that you cannot bind to
INADDR_ANY. The socket should bind to port zero.

Once the socket is bound and the IOCTL set, calls to the WSARecv or recv
functions return multicast IP datagrams passing through the given interface. Note
that you must supply a sufficiently large buffer. Setting this IOCTL requires
Administrator privilege on the local computer.

SIO_RCVALL_MCAST is supported on Windows 2000 and later.


SIO_ROUTING_INTERFACE_CHANGE (opcode setting: I, T==1)

To receive notification of a routing interface change that should be used


to reach the remote address in the input buffer (specified as a sockaddr
structure). No output information on the new routing interface will be provided
upon completion of this IOCTL; the completion merely indicates that the routing
interface for a given destination has changed and should be queried using the
SIO_ROUTING_INTERFACE_QUERY IOCTL.

It is assumed, although not required, that the application uses overlapped


I/O to be notified of the routing interface change through completion of
SIO_ROUTING_INTERFACE_CHANGE request. Alternatively, if the
SIO_ROUTING_INTERFACE_CHANGE IOCTL is issued on a non-blocking socket with the
lpOverlapped and lpCompletionRoutine parameters set to NULL), it will complete
immediately returning and WSAEWOULDBLOCK as an error, and the application can then
wait for routing change events through call to WSAEventSelect or WSAAsyncSelect
with FD_ROUTING_INTERFACE_CHANGE bit set in the network event bitmask.

It is recognized that routing information remains stable in most cases so


that requiring the application to keep multiple outstanding IOCTLs to get
notifications about all destinations that it is interested in as well as having
the service provider keep track of these notification requests will use a
significant amount system resources. This situation can be avoided by extending
the meaning of the input parameters and relaxing the service provider requirements
as follows:

* The application can specify a protocol family specific wildcard


address (same as one used in bind call when requesting to bind to any available
address) to request notifications of any routing changes. This allows the
application to keep only one outstanding SIO_ROUTING_INTERFACE_CHANGE for all the
sockets and destinations it has and then use SIO_ROUTING_INTERFACE_QUERY to get
the actual routing information.
* A service provider has the option to ignore the information
specified by the application in the input buffer of the
SIO_ROUTING_INTERFACE_CHANGE (as though the application specified a wildcard
address) and complete the SIO_ROUTING_INTERFACE_CHANGE IOCTL or signal
FD_ROUTING_INTERFACE_CHANGE event in the event of any routing information change
(not just the route to the destination specified in the input buffer).

SIO_ROUTING_INTERFACE_QUERY (opcode setting: I, O, T==1)

To obtain the address of the local interface (represented as sockaddr


structure) which should be used to send to the remote address specified in the
input buffer (as sockaddr). Remote multicast addresses may be submitted in the
input buffer to get the address of the preferred interface for multicast
transmission. In any case, the interface address returned may be used by the
application in a subsequent bind() request.

Note that routes are subject to change. Therefore, applications cannot


rely on the information returned by SIO_ROUTING_INTERFACE_QUERY to be persistent.
Applications may register for routing change notifications through the
SIO_ROUTING_INTERFACE_CHANGE IOCTL which provides for notification through either
overlapped I/O or a FD_ROUTING_INTERFACE_CHANGE event. The following sequence of
actions can be used to guarantee that the application always has current routing
interface information for a given destination:

* Issue SIO_ROUTING_INTERFACE_CHANGE IOCTL


* Issue SIO_ROUTING_INTERFACE_QUERY IOCTL
* Whenever SIO_ROUTING_INTERFACE_CHANGE IOCTL notifies the application
of routing change (either through overlapped I/O or by signaling
FD_ROUTING_INTERFACE_CHANGE event), the whole sequence of actions should be
repeated.

If the output buffer is not large enough to contain the interface address,
SOCKET_ERROR is returned as the result of this IOCTL and WSAGetLastError returns
WSAEFAULT. The required size of the output buffer will be returned in
lpcbBytesReturned in this case. Note the WSAEFAULT error code is also returned if
the lpvInBuffer, lpvOutBuffer, or lpcbBytesReturned parameter is not totally
contained in a valid part of the user address space.

If the destination address specified in the input buffer cannot be reached


through any of the available interfaces, SOCKET_ERROR is returned as the result of
this IOCTL and WSAGetLastError returns WSAENETUNREACH or even WSAENETDOWN if all
of the network connectivity is lost.
SIO_SET_COMPATIBILITY_MODE (opcode setting: I, T==3)

Requests how the networking stack should handle certain behaviors for
which the default way of handling the behavior may differ across Windows versions.
The argument structure for SIO_SET_COMPATIBILITY_MODE is specified in the
WSA_COMPATIBILITY_MODE structure defined in the Mswsockdef.h header file. This
structure is defined as follows:

Copy Code

/* Argument structure for SIO_SET_COMPATIBILITY_MODE */


typedef struct _WSA_COMPATIBILITY_MODE {
WSA_COMPATIBILITY_BEHAVIOR_ID BehaviorId;
ULONG TargetOsVersion;
} WSA_COMPATIBILITY_MODE, *PWSA_COMPATIBILITY_MODE;

The value specified in the BehaviorId member indicates the behavior


requested. The value specified in the TargetOsVersion member indicates the Windows
version that is being requested for the behavior.

The BehaviorId member can be one of the values from the


WSA_COMPATIBILITY_BEHAVIOR_ID enumeration type defined in the Mswsockdef.h header
file. The possible values for the BehaviorId member are as follows

Term Description

WsaBehaviorAll
This is equivalent to requesting all of the possible compatible behaviors
defined for WSA_COMPATIBILITY_BEHAVIOR_ID.

WsaBehaviorReceiveBuffering

When the TargetOsVersion member is set to a value for Windows Vista or


later, reductions to the TCP receive buffer size on this socket using the
SO_RCVBUF socket option are allowed even after a TCP connection has been
establishment.

When the TargetOsVersion member is set to a value earlier than Windows


Vista, reductions to the TCP receive buffer size on this socket using the
SO_RCVBUF socket option are not allowed after connection establishment.

WsaBehaviorAutoTuning

When the TargetOsVersion member is set to a value for Windows Vista or


later, receive window auto-tuning is enabled and the TCP window scale factor is
reduced to 2 from the default value of 8.

When the TargetOsVersion is set to a value earlier than Windows Vista,


receive window auto-tuning is disabled. The TCP window scaling option is also
disabled and the maximum true receive window size is limited to 65,535 bytes. The
TCP window scaling option can't be negotiated on the connection even if the
SO_RCVBUF socket option was called on this socket specifying a value greater than
65,535 bytes before the connection was established.

For more detailed information, see the SIO_SET_COMPATIBILITY_MODE


reference.

SIO_SET_COMPATIBILITY_MODE is supported on Windows Vista and later.


SIO_SET_GROUP_QOS (opcode setting: I, T==1)

Reserved.
SIO_SET_QOS (opcode setting: I, T==1)

Associate the specified QOS structure with the socket. No output buffer is
required, the QOS structure will be obtained from the input buffer. The
WSAENOPROTOOPT error code is indicated for service providers that do not support
quality of service.
SIO_TRANSLATE_HANDLE (opcode setting: I, O, T==1)

To obtain a corresponding handle for socket s that is valid in the context


of a companion interface (for example, TH_NETDEV and TH_TAPI). A manifest constant
identifying the companion interface along with any other needed parameters are
specified in the input buffer. The corresponding handle will be available in the
output buffer upon completion of this function. Refer to the appropriate section
in Winsock Annexes for details specific to a particular companion interface. The
WSAENOPROTOOPT error code is indicated for service providers that do not support
this IOCTL for the specified companion interface. This IOCTL retrieves the handle
associated using SIO_TRANSLATE_HANDLE.

It is recommend that the Component Object Model (COM) be used instead of


this IOCTL to discover and track other interfaces that might be supported by a
socket. This IOCTL is present for backward compatibility with systems where COM is
not available or cannot be used for some other reason.
SIO_UDP_CONNRESET (opcode setting: I, T==3)

Windows XP: Controls whether UDP PORT_UNREACHABLE messages are


reported. Set to TRUE to enable reporting. Set to FALSE to disable reporting.

__________________________________________________________________________________
__________

Winsock Annexes

Winsock Annexes provide implementation information for common Winsock protocol


suites, and discuss how to use each protocol with Winsock.

Each protocol in this annex has conventions, behaviors, or special features that
do not lend themselves to generic implementation. This section documents details
that developers must consider when implementing or using the described protocols.

The Winsock Annexes include the following sections:

* Winsock ATM Annex


* Winsock IPX/SPX Annex
* Winsock TCP/IP Annex

Winsock ATM Annex

ATM is applicable to both LAN and WAN environments. An ATM network simultaneously
transports a wide variety of network traffic � voice, data, image, and video. It
provides users with a guaranteed quality of service on a per-virtual channel (VC)
basis.

Element Description
Protocol name(s) ATMPROTO_AAL5, ATMPROTO_AALUSER
Description ATM AAL5 provides a transport service that is connection
oriented, message-boundary preserved, and QOS guaranteed. ATMPROTO_AALUSER is a
user-defined AAL.
Address family AF_ATM
Header file Ws2atm.h

This section describes the Asynchronous Transfer Mode (ATM)-specific extensions


needed to support the native ATM services as exposed and specified in the ATM
Forum User Network Interface (UNI) specification version 3.x (3.0 and 3.1). This
document supports AAL type 5 (message mode) and user-defined AAL. Future versions
of this document will support other types of AAL as well as UNI 4.0.

Winsock IPX/SPX Annex

This section describes Winsock extensions specific to Internetwork Packet


Exchange/Sequenced Packet Exchange (IPX/SPX). It also describes aspects of base
Winsock functions that either require special consideration or may exhibit unique
behavior.

Element Description
Protocol name(s) IPX, SPX
Description Provides transport services over the IPX networking layer: IPX
for unreliable datagrams, SPX for reliable, connection-oriented message streams.
Address family AF_IPX
Header file Wsipx.h
This section discusses how to use Winsock with the IPX family of protocols,
enabling traditional IPX applications to be ported to Winsock. IPX networks
operate in a fundamentally different manner than IP networks, so such differences
must be considered when using IPX/SPX.

Winsock TCP/IP Annex

This section describes Transmission Control Protocol/Internet Protocol (TCP/IP)


functions, data structures, and controls.

Element Description
Protocol name(s) TCP, UDP
Description Provides transport services over the IP networking layer: UDP for
unreliable datagrams, TCP for reliable, connection-oriented byte streams.
Address family AF_INET, AF_INET6
Header file Ws2tcpip.h

Two basic types of transport services are offered: unreliable datagrams (UDP), and
reliable connection oriented�byte streams (TCP). In addition, a raw socket is
optionally supported. Raw sockets allow an application to communicate through
protocols other than TCP and UDP such as ICMP. Raw sockets are supported on the
AF_INET and AF_INET6 address families with some limitations.

This section covers extensions to Winsock that are specific to TCP/IP protocols.
It also describes aspects of base Winsock functions that require special
consideration or that may exhibit unique behavior when using TCP/IP.

__________________________________________________________________________________
_________________

Winsock Enumerations

The following list provides concise descriptions of each Winsock enumeration. For
additional information on any enumeration, click the enumeration name.

Enumeration Description
eWINDOW_ADVANCE_METHOD Specifies the window advance mode used for Reliable
Multicast.
GUARANTEE No longer used.
MULTICAST_MODE_TYPE Specifies the filter mode for multicast group addresses.
NAPI_PROVIDER_LEVEL Specifies the provider authority level of a NS_EMAIL
namespace provider for a given domain.
NAPI_PROVIDER_TYPE Specifies the type of hosting expected for a namespace
provider.
SOCKET_SECURITY_PROTOCOL Indicates the type of security protocol to be used on
a socket.
SOCKET_USAGE_TYPE Used to specified the usage type for the socket.
WSAECOMPARATOR Used for version-comparison semantics.
WSC_PROVIDER_INFO_TYPE Specifies the information class of a layered service
protocol (LSP).

__________________________________________________________________________________
_________________

Winsock Functions

The following list provides concise descriptions of each Winsock function. For
additional information on any function, click the function name.
Function Description
accept Permits an incoming connection attempt on a socket.
AcceptEx Accepts a new connection, returns the local and remote address, and
receives the first block of data sent by the client application.
bind Associates a local address with a socket.
closesocket Closes an existing socket.
connect Establishes a connection to a specified socket.
ConnectEx Establishes a connection to a specified socket, and optionally sends
data once the connection is established. Only supported on connection-oriented
sockets.
DisconnectEx Closes a connection on a socket, and allows the socket handle to
be reused.
EnumProtocols Retrieves information about a specified set of network protocols
that are active on a local host.
freeaddrinfo Frees address information that the getaddrinfo function
dynamically allocates in addrinfo structures.
FreeAddrInfoEx Frees address information that the GetAddrInfoEx function
dynamically allocates in addrinfoex structures.
FreeAddrInfoW Frees address information that the GetAddrInfoW function
dynamically allocates in addrinfoW structures.
gai_strerror Assists in printing error messages based on the EAI_* errors
returned by the getaddrinfo function.
GetAcceptExSockaddrs Parses the data obtained from a call to the AcceptEx
function.
GetAddressByName Queries a namespace, or a set of default namespaces, to retrieve
network address information for a specified network service. This process is known
as service name resolution. A network service can also use the function to obtain
local address information that it can use with the bind function.
getaddrinfo Provides protocol-independent translation from an ANSI host name
to an address.
GetAddrInfoW Provides protocol-independent translation from a Unicode host
name to an address.
GetAddrInfoEx Provides protocol-independent name resolution with additional
parameters to qualify which name space providers should handle the request.
gethostbyaddr Retrieves the host information corresponding to a network
address.
gethostbyname Retrieves host information corresponding to a host name from a
host database. Deprecated: use getaddrinfo instead.
gethostname Retrieves the standard host name for the local computer.
GetNameByType Retrieves the name of a network service for the specified service
type.
getnameinfo Provides name resolution from an IPv4 or IPv6 address to an ANSI
host name and from a port number to the ANSI service name.
GetNameInfoW Provides name resolution from an IPv4 or IPv6 address to a
Unicode host name and from a port number to the Unicode service name.
getpeername Retrieves the address of the peer to which a socket is connected.
getprotobyname Retrieves the protocol information corresponding to a protocol
name.
getprotobynumber Retrieves protocol information corresponding to a protocol
number.
getservbyname Retrieves service information corresponding to a service name and
protocol.
getservbyport Retrieves service information corresponding to a port and
protocol.
GetService Retrieves information about a network service in the context of a set
of default namespaces or a specified namespace.
getsockname Retrieves the local name for a socket.
getsockopt Retrieves a socket option.
GetTypeByName Retrieves a service type GUID for a network service specified by
name.
htonl Converts a u_long from host to TCP/IP network byte order (which is big-
endian).
htons Converts a u_short from host to TCP/IP network byte order (which is
big-endian).
inet_addr Converts a string containing an (Ipv4) Internet Protocol dotted address
into a proper address for the in_addr structure.
inet_ntoa Converts an (IPv4) Internet network address into a string in Internet
standard dotted format.
InetNtop converts an IPv4 or IPv6 Internet network address into a string in
Internet standard format. The ANSI version of this function is inet_ntop.
InetPton Converts an IPv4 or IPv6 Internet network address in its standard text
presentation form into its numeric binary form. The ANSI version of this function
is inet_pton.
ioctlsocket Controls the I/O mode of a socket.
listen Places a socket a state where it is listening for an incoming
connection.
ntohl Converts a u_long from TCP/IP network order to host byte order (which
is little-endian on Intel processors).
ntohs Converts a u_short from TCP/IP network byte order to host byte order
(which is little-endian on Intel processors).
recv Receives data from a connected or bound socket.
recvfrom Receives a datagram and stores the source address.
select Determines the status of one or more sockets, waiting if necessary, to
perform synchronous I/O.
send Sends data on a connected socket.
sendto Sends data to a specific destination.
SetAddrInfoEx Registers a host and service name along with associated addresses
with a specific namespace provider.
SetService Registers or removes from the registry a network service within one or
more namespaces. Can also add or remove a network service type within one or more
namespaces.
setsockopt Sets a socket option.
shutdown Disables sends or receives on a socket.
socket Creates a socket that is bound to a specific service provider.
TransmitFile Transmits file data over a connected socket handle.
TransmitPackets Transmits in-memory data or file data over a connected socket.
WSAAccept Conditionally accepts a connection based on the return value of a
condition function, provides quality of service flow specifications, and allows
the transfer of connection data.
WSAAddressToString Converts all components of a sockaddr structure into a
human-readable string representation of the address.
WSAAsyncGetHostByAddr Asynchronously retrieves host information that corresponds
to an address.
WSAAsyncGetHostByName Asynchronously retrieves host information that corresponds
to a host name.
WSAAsyncGetProtoByName Asynchronously retrieves protocol information that
corresponds to a protocol name.
WSAAsyncGetProtoByNumber Asynchronously retrieves protocol information that
corresponds to a protocol number.
WSAAsyncGetServByName Asynchronously retrieves service information that
corresponds to a service name and port.
WSAAsyncGetServByPort Asynchronously retrieves service information that
corresponds to a port and protocol.
WSAAsyncSelect Requests Windows message-based notification of network events for
a socket.
WSACancelAsyncRequest Cancels an incomplete asynchronous operation.
WSACleanup Terminates use of the Ws2_32.DLL.
WSACloseEvent Closes an open event object handle.
WSAConnect Establishes a connection to another socket application, exchanges
connect data, and specifies needed quality of service based on the specified
FLOWSPEC structure.
WSAConnectByList Establishes a connection to one out of a collection of possible
endpoints represented by a set of destination addresses (host names and ports).
WSAConnectByName Establishes a connection to another socket application on a
specified host and port
WSACreateEvent Creates a new event object.
WSADeleteSocketPeerTargetName Removes the association between a peer target
name and an IP address for a socket.
WSADuplicateSocket Returns a structure that can be used to create a new socket
descriptor for a shared socket.
WSAEnumNameSpaceProviders Retrieves information about available namespaces.
WSAEnumNameSpaceProvidersEx Retrieves information about available namespaces.
WSAEnumNetworkEvents Discovers occurrences of network events for the indicated
socket, clear internal network event records, and reset event objects (optional).
WSAEnumProtocols Retrieves information about available transport protocols.
WSAEventSelect Specifies an event object to be associated with the specified set
of FD_XXX network events.
__WSAFDIsSet Specifies whether a socket is included in a set of socket
descriptors.
WSAGetLastError Returns the error status for the last operation that failed.
WSAGetOverlappedResult Retrieves the results of an overlapped operation on the
specified socket.
WSAGetQOSByName Initializes a QOS structure based on a named template, or it
supplies a buffer to retrieve an enumeration of the available template names.
WSAGetServiceClassInfo Retrieves the class information (schema) pertaining to a
specified service class from a specified namespace provider.
WSAGetServiceClassNameByClassId Retrieves the name of the service associated
with the specified type.
WSAHtonl Converts a u_long from host byte order to network byte order.
WSAHtons Converts a u_short from host byte order to network byte order.
WSAImpersonateSocketPeer Used to impersonate the security principal
corresponding to a socket peer in order to perform application-level
authorization.
WSAInstallServiceClass Registers a service class schema within a namespace.
WSAIoctl Controls the mode of a socket.
WSAJoinLeaf Joins a leaf node into a multipoint session, exchanges connect
data, and specifies needed quality of service based on the specified structures.
WSALookupServiceBegin Initiates a client query that is constrained by the
information contained within a WSAQUERYSET structure.
WSALookupServiceEnd Frees the handle used by previous calls to
WSALookupServiceBegin and WSALookupServiceNext.
WSALookupServiceNext Retrieve the requested service information.
WSANSPIoctl Developers to make I/O control calls to a registered namespace.
WSANtohl Converts a u_long from network byte order to host byte order.
WSANtohs Converts a u_short from network byte order to host byte order.
WSAPoll Determines status of one or more sockets.
WSAProviderConfigChange Notifies the application when the provider
configuration is changed.
WSAQuerySocketSecurity Queries information about the security applied to a
connection on a socket.
WSARecv Receives data from a connected socket.
WSARecvDisconnect Terminates reception on a socket, and retrieves the
disconnect data if the socket is connection oriented.
WSARecvEx Receives data from a connected socket.
WSARecvFrom Receives a datagram and stores the source address.
WSARecvMsg Receives data and optional control information from connected and
unconnected sockets.
WSARemoveServiceClass Permanently removes the service class schema from the
registry.
WSAResetEvent Resets the state of the specified event object to nonsignaled.
WSARevertImpersonation Terminates the impersonation of a socket peer.
WSASend Sends data on a connected socket.
WSASendDisconnect Initiates termination of the connection for the socket and
sends disconnect data.
WSASendMsg Sends data and optional control information from connected and
unconnected sockets.
WSASendTo Sends data to a specific destination, using overlapped I/O where
applicable.
WSASetEvent Sets the state of the specified event object to signaled.
WSASetLastError Sets the error code.
WSASetService Registers or removes from the registry a service instance within
one or more namespaces.
WSASetSocketPeerTargetName Used to specify the peer target name (SPN) that
corresponds to a peer IP address. This target name is meant to be specified by
client applications to securely identify the peer that should be authenticated.
WSASetSocketSecurity Enables and applies security for a socket.
WSASocket Creates a socket that is bound to a specific transport-service
provider.
WSAStartup Initiates use of WS2_32.DLL by a process.
WSAStringToAddress Converts a numeric string to a sockaddr structure.
WSAWaitForMultipleEvents Returns either when one or all of the specified event
objects are in the signaled state, or when the time-out interval expires.

__________________________________________________________________________________
_________

Winsock Structures

The following list provides concise descriptions of each Winsock structure. For
additional information on any structure, click the structure name.

Structure Description
addrinfo Used by the getaddrinfo function to hold host address information.
addrinfoW Used by the GetAddrInfoW function to hold host address information.
addrinfoex Used by the GetAddrInfoEx function to hold host address information.
AFPROTOCOLS Supplies a list of protocols to which application programmers can
constrain queries. Used for query purposes only.
BLOB Contains information about a block of data. Derived from Binary Large
Object.
CSADDR_INFO Contains Winsock address information for a network service or
namespace provider.
fd_set Used by various Winsock functions and service providers, such as
select, to place sockets into a "set" for various purposes, such as testing a
given socket for readability.
GROUP_FILTER Provides multicast filtering parameters for multicast IPv6 or
IPv4 addresses.
GROUP_REQ Provides multicast group information for IPv6 or IPv4 addresses.
GROUP_SOURCE_REQ Provides multicast group information for IPv6 or IPv4 addresses
that includes the source IP address.
hostent Stores information about a given host, such as host name, IP address,
and so forth.
in_addr Represents an IPv4 Internet address.
in_pktinfo Stores received packet address information, and is used by Windows to
return information about received packets.
in6_addr Represents an IPv6 Internet address.
in6_pktinfo Stores received IPv6 packet address information, and is used by
Windows to return information about received packets.
ip_mreq Provides multicast group information for IPv4 addresses.
ip_mreq_source Provides multicast group and source information for IPv4
addresses.
ip_msfilter Provides multicast filtering parameters for IPv4 addresses.
ipv6_mreq Provides multicast group information for IPv6 addresses.
linger Maintains information about a specific socket that specifies how that
socket should behave when data is queued to be sent and the closesocket function
is called on the socket.
NAPI_DOMAIN_DESCRIPTION_BLOB Describes a domain handled by a namespace provider
for the NS_EMAIL namespace.
NAPI_PROVIDER_INSTALLATION_BLOB Contains the information required to install a
namespace provider for the NS_EMAIL namespace.
NS_SERVICE_INFO Contains information about a network service or a network service
type in the context of a specified namespace, or a set of default namespaces.
PROTOCOL_INFO Contains information about a protocol.
protoent Contains the name and protocol numbers that correspond to a given
protocol name.
RM_FEC_INFO Specifies settings for using forward error correction (FEC) with
Reliable Multicast.
RM_RECEIVER_STATS Provides statistical information for a Reliable Multicast
receiver session.
RM_SEND_WINDOW Specifies the Reliable Multicast send window.
RM_SENDER_STATS Provides statistical information for a Reliable Multicast sender
session.
servent Stores or returns the name and service number for a given service name.
SERVICE_ADDRESS Contains address information for a service.
SERVICE_ADDRESSES Contains an array of SERVICE_ADDRESS data structures.
SERVICE_INFO Contains information about a network service or a network service
type.
SERVICE_TYPE_INFO_ABS Contains information about a network service type.
SERVICE_TYPE_VALUE_ABS Contains information about a network-service type value.
The information may be specific to a namespace.
sockaddr Contains socket address information. The sockaddr structure varies
depending on the protocol selected. Limited to IPv4; use SOCKADDR_STORAGE instead.
SOCKADDR_IRDA Used with IrDA socket operations, defined by address family
AF_IRDA.
SOCKADDR_STORAGE Stores socket address information, and is sufficiently large to
store IPv4 or IPv6 address information, promoting protocol-family and protocol-
version independence. Use this structure in place of the sockaddr structure.
SOCKET_ADDRESS Stores protocol-specific address information.
SOCKET_ADDRESS_LIST Stores an array of SOCKET_ADDRESS structures that contain
protocol-specific address information.
SOCKET_PEER_TARGET_NAME Contains the IP address and name for a peer target
and the type of security protocol to be used on a socket.
SOCKET_SECURITY_QUERY_INFO Contains security information returned by the
WSAQuerySocketSecurity function.
SOCKET_SECURITY_QUERY_TEMPLATE Contains the security template used by the
WSAQuerySocketSecurity function.
SOCKET_SECURITY_SETTINGS Specifies generic security requirements for a socket.
SOCKET_SECURITY_SETTINGS_IPSEC Specifies various security requirements and
settings that are specific to IPsec.
timeval Used to specify time values. Associated with the Berkeley Software
Distribution (BSD) file Time.h.
TRANSMIT_FILE_BUFFERS Specifies data to be transmitted before and after file data
during a TransmitFile transfer operation.
TRANSMIT_PACKETS_ELEMENT Specifies a single data element to be transmitted by
the TransmitPackets function.
WSABUF Enables the creation or manipulation of a data buffer.
WSACOMPLETION Specifies completion notification settings for I/O control calls
made to a registered namespace.
WSADATA Contains information about the Windows Sockets implementation.
WSAMSG Stores address and optional control information about connected and
unconnected sockets. Used with the WSARecvMsg function.
WSANAMESPACE_INFO Contains registration information for a namespace provider.
WSANAMESPACE_INFOEX Contains enhanced registration information for a namespace
provider.
WSANETWORKEVENTS Stores a socket's internal information about network events.
WSANSCLASSINFO Provides individual parameter information for a specific Winsock
namespace.
WSAOVERLAPPED Provides a communication medium between the initiation of an
overlapped I/O operation and its subsequent completion.
WSAPOLLFD Stores socket information used by the WSAPoll function.
WSAPROTOCOL_INFO Stores or retrieves complete information for a given protocol.
WSAPROTOCOL_INFOW Store or retrieves complete information for a given
protocol. The protocol name is represented as an array of Unicode characters.
WSAPROTOCOLCHAIN Contains a counted list of Catalog Entry identifiers that
comprise a protocol chain.
WSAQUERYSET Provides relevant information about a given service.
WSAQUERYSET2 Provides relevant information about a given service.
WSASERVICECLASSINFO Contains information about a specified service class.
WSAVERSION Provides version comparison in Winsock.

_________________________________________________________________________________

Winsock SPI

The Winsock Service Provider Interface, or Winsock SPI, is a specialized


discipline of Winsock used to create providers; transport providers such as TCP/IP
or IPX/SPX protocol stacks use the Winsock SPI, as do namespace providers such as
the Internet's Domain Naming System (DNS).

Traditional network programming, such as enabling applications to communicate over


the network, does not require use of Winsock SPI interfaces; use standard Winsock
interfaces instead.

The Winsock SPI uses the following function prefix naming convention.
Prefix Meaning Description
WSP Windows Sockets Service Provider Transport service provider entry points
WPU Windows Sockets Provider Upcall Ws2_32.dll entry points for service
providers
WSC Windows Sockets Configuration WS2_32.dll entry points for installation
applets
NSP Namespace Provider Namespace provider entry points
_________________________________________________________________________________

Windows Sockets Error Codes

Most Windows Sockets 2 functions do not return the specific cause of an error when
the function returns. For information, see the Handling Winsock Errors topic.
The following list describes the possible error codes returned by the
WSAGetLastError function. Errors are listed in numerical order with the error
macro name. Some error codes defined in Winsock2.h are not returned from any
function.
Return code/value Description

WSA_INVALID_HANDLE 6 : Specified event object handle is invalid.


An application attempts to use an event object, but the specified handle is
not valid. Note that this error is returned by the operating system, so the error
number may change in future releases of Windows.

WSA_NOT_ENOUGH_MEMORY 8 : Insufficient memory available.


An application used a Windows Sockets function that directly maps to a Windows
function. The Windows function is indicating a lack of required memory resources.
Note that this error is returned by the operating system, so the error number may
change in future releases of Windows.

WSA_INVALID_PARAMETER 87 : One or more parameters are invalid.


An application used a Windows Sockets function which directly maps to a
Windows function. The Windows function is indicating a problem with one or more
parameters. Note that this error is returned by the operating system, so the error
number may change in future releases of Windows.

WSA_OPERATION_ABORTED 995 : Overlapped operation aborted.


An overlapped operation was canceled due to the closure of the socket, or the
execution of the SIO_FLUSH command in WSAIoctl. Note that this error is returned
by the operating system, so the error number may change in future releases of
Windows.

WSA_IO_INCOMPLETE 996 : Overlapped I/O event object not in signaled state.


The application has tried to determine the status of an overlapped operation
which is not yet completed. Applications that use WSAGetOverlappedResult (with the
fWait flag set to FALSE) in a polling mode to determine when an overlapped
operation has completed, get this error code until the operation is complete. Note
that this error is returned by the operating system, so the error number may
change in future releases of Windows.

WSA_IO_PENDING 997 : Overlapped operations will complete later.


The application has initiated an overlapped operation that cannot be completed
immediately. A completion indication will be given later when the operation has
been completed. Note that this error is returned by the operating system, so the
error number may change in future releases of Windows.

WSAEINTR 10004 : Interrupted function call.


A blocking operation was interrupted by a call to WSACancelBlockingCall.

WSAEBADF 10009 : File handle is not valid.


The file handle supplied is not valid.

WSAEACCES 10013 : Permission denied.


An attempt was made to access a socket in a way forbidden by its access
permissions. An example is using a broadcast address for sendto without broadcast
permission being set using setsockopt(SO_BROADCAST).

Another possible reason for the WSAEACCES error is that when the bind function
is called (on Windows NT 4 SP4 or later), another application, service, or kernel
mode driver is bound to the same address with exclusive access. Such exclusive
access is a new feature of Windows NT 4 SP4 and later, and is implemented by using
the SO_EXCLUSIVEADDRUSE option.

WSAEFAULT 10014 : Bad address.


The system detected an invalid pointer address in attempting to use a pointer
argument of a call. This error occurs if an application passes an invalid pointer
value, or if the length of the buffer is too small. For instance, if the length of
an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).

WSAEINVAL 10022 : Invalid argument.


Some invalid argument was supplied (for example, specifying an invalid level
to the setsockopt function). In some instances, it also refers to the current
state of the socket�for instance, calling accept on a socket that is not
listening.

WSAEMFILE 10024 : Too many open files.


Too many open sockets. Each implementation may have a maximum number of socket
handles available, either globally, per process, or per thread.

WSAEWOULDBLOCK 10035 : Resource temporarily unavailable.


This error is returned from operations on nonblocking sockets that cannot be
completed immediately, for example recv when no data is queued to be read from the
socket. It is a nonfatal error, and the operation should be retried later. It is
normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a
nonblocking SOCK_STREAM socket, since some time must elapse for the connection to
be established.

WSAEINPROGRESS 10036 : Operation now in progress.


A blocking operation is currently executing. Windows Sockets only allows a
single blocking operation�per- task or thread�to be outstanding, and if any other
function call is made (whether or not it references that or any other socket) the
function fails with the WSAEINPROGRESS error.

WSAEALREADY 10037 : Operation already in progress.


An operation was attempted on a nonblocking socket with an operation already
in progress�that is, calling connect a second time on a nonblocking socket that is
already connecting, or canceling an asynchronous request (WSAAsyncGetXbyY) that
has already been canceled or completed.

WSAENOTSOCK 10038 : Socket operation on nonsocket.


An operation was attempted on something that is not a socket. Either the
socket handle parameter did not reference a valid socket, or for select, a member
of an fd_set was not valid.

WSAEDESTADDRREQ 10039 : Destination address required.


A required address was omitted from an operation on a socket. For example,
this error is returned if sendto is called with the remote address of ADDR_ANY.

WSAEMSGSIZE 10040 : Message too long.


A message sent on a datagram socket was larger than the internal message
buffer or some other network limit, or the buffer used to receive a datagram was
smaller than the datagram itself.

WSAEPROTOTYPE 10041 : Protocol wrong type for socket.


A protocol was specified in the socket function call that does not support the
semantics of the socket type requested. For example, the ARPA Internet UDP
protocol cannot be specified with a socket type of SOCK_STREAM.
WSAENOPROTOOPT 10042 : Bad protocol option.
An unknown, invalid or unsupported option or level was specified in a
getsockopt or setsockopt call.

WSAEPROTONOSUPPORT 10043 : Protocol not supported.


The requested protocol has not been configured into the system, or no
implementation for it exists. For example, a socket call requests a SOCK_DGRAM
socket, but specifies a stream protocol.

WSAESOCKTNOSUPPORT
10044

Socket type not supported.

The support for the specified socket type does not exist in this address
family. For example, the optional type SOCK_RAW might be selected in a socket
call, and the implementation does not support SOCK_RAW sockets at all.

WSAEOPNOTSUPP
10045

Operation not supported.

The attempted operation is not supported for the type of object referenced.
Usually this occurs when a socket descriptor to a socket that cannot support this
operation is trying to accept a connection on a datagram socket.

WSAEPFNOSUPPORT
10046

Protocol family not supported.

The protocol family has not been configured into the system or no
implementation for it exists. This message has a slightly different meaning from
WSAEAFNOSUPPORT. However, it is interchangeable in most cases, and all Windows
Sockets functions that return one of these messages also specify WSAEAFNOSUPPORT.

WSAEAFNOSUPPORT
10047

Address family not supported by protocol family.

An address incompatible with the requested protocol was used. All sockets are
created with an associated address family (that is, AF_INET for Internet
Protocols) and a generic protocol type (that is, SOCK_STREAM). This error is
returned if an incorrect protocol is explicitly requested in the socket call, or
if an address of the wrong family is used for a socket, for example, in sendto.

WSAEADDRINUSE
10048

Address already in use.


Typically, only one usage of each socket address (protocol/IP address/port) is
permitted. This error occurs if an application attempts to bind a socket to an IP
address/port that has already been used for an existing socket, or a socket that
was not closed properly, or one that is still in the process of closing. For
server applications that need to bind multiple sockets to the same port number,
consider using setsockopt (SO_REUSEADDR). Client applications usually need not
call bind at all�connect chooses an unused port automatically. When bind is called
with a wildcard address (involving ADDR_ANY), a WSAEADDRINUSE error could be
delayed until the specific address is committed. This could happen with a call to
another function later, including connect, listen, WSAConnect, or WSAJoinLeaf.

WSAEADDRNOTAVAIL
10049

Cannot assign requested address.

The requested address is not valid in its context. This normally results from
an attempt to bind to an address that is not valid for the local computer. This
can also result from connect, sendto, WSAConnect, WSAJoinLeaf, or WSASendTo when
the remote address or port is not valid for a remote computer (for example,
address or port 0).

WSAENETDOWN
10050

Network is down.

A socket operation encountered a dead network. This could indicate a serious


failure of the network system (that is, the protocol stack that the Windows
Sockets DLL runs over), the network interface, or the local network itself.

WSAENETUNREACH
10051

Network is unreachable.

A socket operation was attempted to an unreachable network. This usually means


the local software knows no route to reach the remote host.

WSAENETRESET
10052

Network dropped connection on reset.

The connection has been broken due to keep-alive activity detecting a failure
while the operation was in progress. It can also be returned by setsockopt if an
attempt is made to set SO_KEEPALIVE on a connection that has already failed.

WSAECONNABORTED
10053

Software caused connection abort.


An established connection was aborted by the software in your host computer,
possibly due to a data transmission time-out or protocol error.

WSAECONNRESET
10054

Connection reset by peer.

An existing connection was forcibly closed by the remote host. This normally
results if the peer application on the remote host is suddenly stopped, the host
is rebooted, the host or remote network interface is disabled, or the remote host
uses a hard close (see setsockopt for more information on the SO_LINGER option on
the remote socket). This error may also result if a connection was broken due to
keep-alive activity detecting a failure while one or more operations are in
progress. Operations that were in progress fail with WSAENETRESET. Subsequent
operations fail with WSAECONNRESET.

WSAENOBUFS
10055

No buffer space available.

An operation on a socket could not be performed because the system lacked


sufficient buffer space or because a queue was full.

WSAEISCONN
10056

Socket is already connected.

A connect request was made on an already-connected socket. Some


implementations also return this error if sendto is called on a connected
SOCK_DGRAM socket (for SOCK_STREAM sockets, the to parameter in sendto is ignored)
although other implementations treat this as a legal occurrence.

WSAENOTCONN
10057

Socket is not connected.

A request to send or receive data was disallowed because the socket is not
connected and (when sending on a datagram socket using sendto) no address was
supplied. Any other type of operation might also return this error�for example,
setsockopt setting SO_KEEPALIVE if the connection has been reset.

WSAESHUTDOWN
10058

Cannot send after socket shutdown.

A request to send or receive data was disallowed because the socket had
already been shut down in that direction with a previous shutdown call. By calling
shutdown a partial close of a socket is requested, which is a signal that sending
or receiving, or both have been discontinued.

WSAETOOMANYREFS
10059

Too many references.

Too many references to some kernel object.

WSAETIMEDOUT
10060

Connection timed out.

A connection attempt failed because the connected party did not properly
respond after a period of time, or the established connection failed because the
connected host has failed to respond.

WSAECONNREFUSED
10061

Connection refused.

No connection could be made because the target computer actively refused it.
This usually results from trying to connect to a service that is inactive on the
foreign host�that is, one with no server application running.

WSAELOOP
10062

Cannot translate name.

Cannot translate a name.

WSAENAMETOOLONG
10063

Name too long.

A name component or a name was too long.

WSAEHOSTDOWN
10064

Host is down.

A socket operation failed because the destination host is down. A socket


operation encountered a dead host. Networking activity on the local host has not
been initiated. These conditions are more likely to be indicated by the error
WSAETIMEDOUT.

WSAEHOSTUNREACH
10065

No route to host.

A socket operation was attempted to an unreachable host. See WSAENETUNREACH.

WSAENOTEMPTY
10066

Directory not empty.

Cannot remove a directory that is not empty.

WSAEPROCLIM
10067

Too many processes.

A Windows Sockets implementation may have a limit on the number of


applications that can use it simultaneously.WSAStartup may fail with this error if
the limit has been reached.

WSAEUSERS
10068

User quota exceeded.

Ran out of user quota.

WSAEDQUOT
10069

Disk quota exceeded.

Ran out of disk quota.

WSAESTALE 10070 : Stale file handle reference.

The file handle reference is no longer available.

WSAEREMOTE 10071 : Item is remote.

The item is not available locally.

WSASYSNOTREADY 10091 : Network subsystem is unavailable.

This error is returned by WSAStartup if the Windows Sockets implementation


cannot function at this time because the underlying system it uses to provide
network services is currently unavailable. Users should check:

* That the appropriate Windows Sockets DLL file is in the current path.
* That they are not trying to use more than one Windows Sockets implementation
simultaneously. If there is more than one Winsock DLL on your system, be sure the
first one in the path is appropriate for the network subsystem currently loaded.
* The Windows Sockets implementation documentation to be sure all necessary
components are currently installed and configured correctly.

WSAVERNOTSUPPORTED 10092 : Winsock.dll version out of range.

The current Windows Sockets implementation does not support the Windows
Sockets specification version requested by the application. Check that no old
Windows Sockets DLL files are being accessed.

WSANOTINITIALISED 10093 : Successful WSAStartup not yet performed.

Either the application has not called WSAStartup or WSAStartup failed. The
application may be accessing a socket that the current active task does not own
(that is, trying to share a socket between tasks), or WSACleanup has been called
too many times.

WSAEDISCON 10101 : Graceful shutdown in progress.

Returned by WSARecv and WSARecvFrom to indicate that the remote party has
initiated a graceful shutdown sequence.

WSAENOMORE 10102 : No more results.

No more results can be returned by the WSALookupServiceNext function.

WSAECANCELLED 10103 : Call has been canceled.

A call to the WSALookupServiceEnd function was made while this call was still
processing. The call has been canceled.

WSAEINVALIDPROCTABLE 10104 : Procedure call table is invalid.

The service provider procedure call table is invalid. A service provider


returned a bogus procedure table to Ws2_32.dll. This is usually caused by one or
more of the function pointers being NULL.

WSAEINVALIDPROVIDER 10105 : Service provider is invalid.

The requested service provider is invalid. This error is returned by the


WSCGetProviderInfo and WSCGetProviderInfo32 functions if the protocol entry
specified could not be found. This error is also returned if the service provider
returned a version number other than 2.0.

WSAEPROVIDERFAILEDINIT 10106 : Service provider failed to initialize.

The requested service provider could not be loaded or initialized. This error
is returned if either a service provider's DLL could not be loaded (LoadLibrary
failed) or the provider's WSPStartup or NSPStartup function failed.

WSASYSCALLFAILURE 10107 : System call failure.

A system call that should never fail has failed. This is a generic error code,
returned under various conditions.

Returned when a system call that should never fail does fail. For example, if
a call to WaitForMultipleEvents fails or one of the registry functions fails
trying to manipulate the protocol/namespace catalogs.
Returned when a provider does not return SUCCESS and does not provide an
extended error code. Can indicate a service provider implementation error.

WSASERVICE_NOT_FOUND 10108 : Service not found.

No such service is known. The service cannot be found in the specified name
space.

WSATYPE_NOT_FOUND 10109 : Class type not found.

The specified class was not found.

WSA_E_NO_MORE 10110 : No more results.

No more results can be returned by the WSALookupServiceNext function.

WSA_E_CANCELLED
10111

Call was canceled.

A call to the WSALookupServiceEnd function was made while this call was still
processing. The call has been canceled.

WSAEREFUSED
10112

Database query was refused.

A database query failed because it was actively refused.

WSAHOST_NOT_FOUND
11001

Host not found.

No such host is known. The name is not an official host name or alias, or it
cannot be found in the database(s) being queried. This error may also be returned
for protocol and service queries, and means that the specified name could not be
found in the relevant database.

WSATRY_AGAIN
11002

Nonauthoritative host not found.

This is usually a temporary error during host name resolution and means that
the local server did not receive a response from an authoritative server. A retry
at some time later may be successful.

WSANO_RECOVERY
11003
This is a nonrecoverable error.

This indicates that some sort of nonrecoverable error occurred during a


database lookup. This may be because the database files (for example, BSD-
compatible HOSTS, SERVICES, or PROTOCOLS files) could not be found, or a DNS
request was returned by the server with a severe error.

WSANO_DATA
11004

Valid name, no data record of requested type.

The requested name is valid and was found in the database, but it does not
have the correct associated data being resolved for. The usual example for this is
a host name-to-address translation attempt (using gethostbyname or
WSAAsyncGetHostByName) which uses the DNS (Domain Name Server). An MX record is
returned but no A record�indicating the host itself exists, but is not directly
reachable.

WSA_QOS_RECEIVERS
11005

QOS receivers.

At least one QOS reserve has arrived.

WSA_QOS_SENDERS
11006

QOS senders.

At least one QOS send path has arrived.

WSA_QOS_NO_SENDERS
11007

No QOS senders.

There are no QOS senders.

WSA_QOS_NO_RECEIVERS
11008

QOS no receivers.

There are no QOS receivers.

WSA_QOS_REQUEST_CONFIRMED
11009

QOS request confirmed.


The QOS reserve request has been confirmed.

WSA_QOS_ADMISSION_FAILURE
11010

QOS admission error.

A QOS error occurred due to lack of resources.

WSA_QOS_POLICY_FAILURE
11011

QOS policy failure.

The QOS request was rejected because the policy system couldn't allocate the
requested resource within the existing policy.

WSA_QOS_BAD_STYLE 11012 : QOS bad style.

An unknown or conflicting QOS style was encountered.

WSA_QOS_BAD_OBJECT 11013 : QOS bad object.

A problem was encountered with some part of the filterspec or the provider-
specific buffer in general.

WSA_QOS_TRAFFIC_CTRL_ERROR 11014 : QOS traffic control error.

An error with the underlying traffic control (TC) API as the generic QOS
request was converted for local enforcement by the TC API. This could be due to an
out of memory error or to an internal QOS provider error.

WSA_QOS_GENERIC_ERROR 11015 : QOS generic error.

A general QOS error.

WSA_QOS_ESERVICETYPE 11016 : QOS service type error.

An invalid or unrecognized service type was found in the QOS flowspec.

WSA_QOS_EFLOWSPEC 11017 : QOS flowspec error.

An invalid or inconsistent flowspec was found in the QOS structure.

WSA_QOS_EPROVSPECBUF 11018 : Invalid QOS provider buffer.

An invalid QOS provider-specific buffer.

WSA_QOS_EFILTERSTYLE 11019 : Invalid QOS filter style.

An invalid QOS filter style was used.

WSA_QOS_EFILTERTYPE 11020 : Invalid QOS filter type.

An invalid QOS filter type was used.


WSA_QOS_EFILTERCOUNT 11021 : Incorrect QOS filter count.

An incorrect number of QOS FILTERSPECs were specified in the FLOWDESCRIPTOR.

WSA_QOS_EOBJLENGTH 11022 : Invalid QOS object length.

An object with an invalid ObjectLength field was specified in the QOS


provider-specific buffer.

WSA_QOS_EFLOWCOUNT 11023 : Incorrect QOS flow count.

An incorrect number of flow descriptors was specified in the QOS structure.

WSA_QOS_EUNKOWNPSOBJ 11024 : Unrecognized QOS object.

An unrecognized object was found in the QOS provider-specific buffer.

WSA_QOS_EPOLICYOBJ 11025 : Invalid QOS policy object.

An invalid policy object was found in the QOS provider-specific buffer.

WSA_QOS_EFLOWDESC 11026 : Invalid QOS flow descriptor.

An invalid QOS flow descriptor was found in the flow descriptor list.

WSA_QOS_EPSFLOWSPEC 11027 : Invalid QOS provider-specific flowspec.

An invalid or inconsistent flowspec was found in the QOS provider-specific


buffer.

WSA_QOS_EPSFILTERSPEC 11028 : Invalid QOS provider-specific filterspec.

An invalid FILTERSPEC was found in the QOS provider-specific buffer.

WSA_QOS_ESDMODEOBJ 11029 : Invalid QOS shape discard mode object.


An invalid shape discard mode object was found in the QOS provider-specific
buffer.

WSA_QOS_ESHAPERATEOBJ 11030 : Invalid QOS shaping rate object.


An invalid shaping rate object was found in the QOS provider-specific buffer.

WSA_QOS_RESERVED_PETYPE 11031 : Reserved policy QOS element type.


A reserved policy element was found in the QOS provider-specific buffer.
__________________________________________________________________________________
_________________________

You might also like