Windows Sockets

The Windows Sockets specification defines a network programming interface for the Microsoft® Windows® operating system that is based on the socket paradigm popularized in the Berkeley Software Distribution (BSD) from the University of California at Berkeley. Windows sockets provide a single API to which application developers can program and multiple network software vendors can conform. Furthermore, in the context of a particular version of Microsoft Windows, it defines an application binary interface such that an application written to the Windows Sockets API can work with a conformant protocol implementation from any network software vendor.

The basic building block for communication is the socket. A socket is an endpoint of communication to which a name may be bound. Each socket in use has a type and an associated process and exists within communication domains. A communication domain is an abstraction introduced to bundle common properties of threads communicating through sockets. Sockets normally exchange data only with sockets in the same domain (it may be possible to cross domain boundaries, but only if some translation process is performed). The Windows sockets facilities support a single communication domain: the Internet domain, used by processes which communicate using the Internet Protocol Suite.

Sockets are typed according to the communication properties visible to a user. Applications are presumed to communicate only between sockets of the same type, although nothing prevents communication between sockets of different types if the underlying communication protocols support this.

Two types of sockets currently are available to a user. A stream socket provides for the bidirectional, reliable, sequenced, and unduplicated flow of data without record boundaries. A datagram socket supports bidirectional flow of data which is not promised to be sequenced, reliable, or unduplicated. That is, a process receiving messages on a datagram socket may find messages duplicated and possibly in an order different from the sending order. An important characteristic of a datagram socket is that record boundaries in data are preserved. Datagram sockets closely model the facilities found in many contemporary packet-switched networks such as Ethernet.

For more information about Windows sockets, see the "Internet, Networking, and Distributed Services" section of the Microsoft Platform SDK.