Winsock 2.2

Windows Mobile 6.5
A version of this page is also available for

The Windows Sockets (Winsock) interface provides a general-purpose networking application programming interface (API) based on the socket interface from the University of California at Berkeley. Winsock is designed to run efficiently on Windows operating systems while maintaining compatibility with the Berkeley Software Distribution (BSD) standard, known as Berkeley Sockets. Most Windows Mobile network communication passes through the Winsock interface. Windows Mobile implements Winsock 2.2 and is fully backward compatible with Winsock 1.1.

Winsock provides a protocol-independent interface capable of supporting emerging networking capabilities, such as real-time multimedia communications. It is used to discover and use communications capabilities of underlying transport protocols. Because it is not a protocol, it does not in any way affect the bits on the wire, and does not need to be used on both ends of a communications link.

Winsock provides access to multiple transport protocols allowing you to create applications that support multiple socket types. Winsock's support of multiple protocols also includes IPv6. Following the Windows Open System Architecture (WOSA) model, Winsock defines a standard service provider interface (SPI) between the application programming interface (API), with its functions exported from the Winsock DLL, Ws2.dll, and the protocol stacks. You can use the Winsock SPI to create your own transport service provider.

Winsock is divided into layers with flexible, installable providers that do the majority of the work. This alleviates the need to replace winsock.dll with a custom version when a new protocol or modifier is needed. The following table shows the transport service providers for Winsock 2.2:

Transport service provider Description

Base Service Provider

A Base Service Provider fully implements a protocol. For example, TCPv4 is fully implemented by the WSPM provider that ships with Windows Mobile.

For more information about the built-in service providers that Windows Mobile provides, see Winsock Service Provider Interface (SPI).

Layered Service Provider (LSP)

An LSP modifies a transport service provider, and therefore the protocol that it implements, to expand, restrict, or redirect its capabilities. For example, the SSL LSP is in the layer above the WSPM provider in what is called a provider chain. This LSP encrypts and decrypts data before it calls into WSPM. WSPM then sends and receives data using the TCP protocol.

You can implement an LSP to extend an existing transport service provider.

Because the following protocols and technologies do not use the Winsock LSP model, you cannot modify them by writing an LSP: DHCP, ICMP, IGMP and other layer 3 protocols; DNS proxy; Redirector; and SMB server

For more information, see Layered Protocols and Provider Chains.

For information about how these transport service providers work with Winsock, see Winsock Architecture.

Windows Mobile also supports socket-based infrared communications called Infrared.

Sockets (IrSock) by using industry standard Infrared Data Association (IrDA) Protocols. Applications implement Infrared Sockets in the same way as conventional Winsock, although several Winsock functions are used differently. Windows Mobile also supports Private Communication Technology 1.0 and Secure Sockets Layer (SSL) versions 2.0 and 3.0 security protocols. These protocols are available either directly from Winsock or through WinInet.

Winsock Support in Windows Mobile

Describes functionality provided by Winsock in Windows Mobile.

Raw Sockets

Describes Windows Mobile support for raw sockets.

Community Additions