Jump to content

Winsock

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Geoffarnold (talk | contribs) at 20:13, 19 February 2006. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

File:Winsock2 logo.gif
Winsock 2 logo

In computing, Winsock (short for Windows Sockets) is a specification that defines how Windows network software should access network services, especially TCP/IP.

Background

Early Microsoft operating systems, both MS-DOS and Windows, offered limited networking capability, chiefly based on NetBIOS (a technology that Microsoft adopted from IBM). In particular, Microsoft completely ignored the TCP/IP protocol stack. A number of university groups and commercial vendors, including the PC/IP group at MIT, FTP Software, Sun Microsystems, Ungermann-Bass, and Excelan, introduced TCP/IP products for MS-DOS, often as part of a hardware/software bundle. When Microsoft Windows was released, these vendors were joined by others such as Distinct and NetManage in offering TCP/IP for Windows. Even Microsoft offered a limited-function product.

The drawback faced by all of these vendors was that each of them used their own API. Without a single standard programming model, it was difficult to persuade independent software developers to create networking applications, and end users were wary of getting locked in to a single vendor.

There had been a number of successful standardization efforts in the PC networking area over the years. The first of these was a program sponsored by the US Air Force to develop RFC1001/1002, a NetBIOS implementation running over TCP/IP. A second was the Crynwr packet driver effort initiated by FTP Software and led by Russ Nelson.

Winsock was proposed by Martin Hall of JSB Software (later Stardust Technologies) at the Interop in October 1991, during a "Birds of a Feather" session. The first edition of the specification was authored by Martin Hall, Mark Towfiq of Microdyne (later Sun Microsystems), Geoff Arnold of Sun Microsystems, and Henry Sanders of Microsoft, with assistance from many others. There was some discussion about how best to address the copyright, intellectual property, and potential anti-trust issues, and consideration was given to working through the IETF or establishing a non-profit foundation. In the end, it was decided that the specification would simply be copyrighted by the four individual authors. (It seems unlikely that corporate legal departments would sanction such an approach these days.)

Technology

Winsock provides two interfaces  : API used by application developers and SPI to which network software vendors should conform. Thereby, for any particular version of Microsoft Windows, Winsock defines a binary interface (ABI) that guarantees an application conforming to the Winsock API will function in concert with any similarly conformant protocol implementation released by any network software vendor. (Although this was important when Winsock was first released, it is now of only academic interest. Microsoft has shipped a high-quality TCP/IP stack with all recent versions of Windows, and there are no significant independent alternatives.)

Winsock is based on BSD sockets, but provides additional functionality to allow the API to comply with the standard Windows programming model.

The Winsock API covered almost all the features of the BSD sockets API, but there were some unavoidable obstacles which mostly arose out of fundamental differences between Windows and Unix (though to be fair Winsock differed less from BSD sockets than the latter did from STREAMS).

Firstly, Unix was able to use the same errno variable to record both networking errors and errors detected within standard C library functions, while Winsock had to use a dedicated function, WSAGetLastError(), to report problems. Secondly, many traditional TCP/IP applications were implemented by using system features specific to Unix, for example pseudo terminals and the fork system call. This made porting Unix networking software possible but often difficult.

Specifications

File:Winsock-small.png
Winsock 1.1 logo
  • Version 1.0 (June 1992) defines the basic operation of Winsock. It's made very close to the existing interface of Berkeley sockets to simplify porting of existing applications. A few Windows-specific extensions are added, mainly for asynchronous operations with message-based notifications.
Although the document doesn't limit the implementations to just TCP/IP support, TCP and UDP are the only protocols explicitly mentioned, and typically the only ones implemented. However, some vendors supplied implementations that supported additional protocols, e.g. Winsock from DEC included DECNet support as well.
  • Version 1.1 (January 1993) made many minor corrections and clarifications of the specification, most significant change being inclusion of gethostname() function.
  • Versions 2.0.x (since May 1994) had internal draft status, and weren't announced as public standards.
Winsock 2 is backwards-compatible extension of Winsock 1.1 interface. It adds specifications for protocol-independent name resolution, asynchronous operations with event-based notifications and completion routines, layered protocol implementations, multicasting and quality of service, and support of multiple protocols, including IPX/SPX and DECNet. New specification allows sockets to be optionally shared between processes, incoming connection requests to be conditionally accepted, and certain operations to be performed on socket groups rather than individual sockets.
The new specification, albeit substantially different from Winsock 1, provided both source-level and binary-level compatibility with existing Winsock 1 applications.
  • Version 2.1.0 (January 1996) is the first public release of Winsock 2 specification.
  • Version 2.2.0 (May 1996) included many minor corrections, clarifications, and advices in the document, as well as removed specification for Winsock 2 in 16-bit Windows environment. Effectively, from then on Winsock 2 is 32-bit-only interface.
  • Version 2.2.1 (May 1997) and Version 2.2.2 (August 1997) made further refinements of Winsock 2 interface. The new functionality was added for querying and receiving notification of changes in network and system configuration.

Implementations

Windows Sockets has been supported by every version of Microsoft's operating system since Windows 3.1, yet the first version of Windows to be shipped with Winsock was Windows 95.

Microsoft implementations

Note that Microsoft didn't supply implementations of Winsock 1.0.

  • Version 1.1 of Winsock was supplied in an add-on package (called Wolverine) for Windows for Workgroups, and natively with Windows 95 and Windows NT 3.x.
Microsoft didn't supply implementations of Winsock 2 for Windows 3.x or Windows NT 3.x.

Winsock built into Windows gradually incorporated new features in new releases and service packs. That means, even though all its versions conform to Winsock 2 specification, they also include a bunch of platform-specific features.

Other implementations

Among the other vendors offering Winsock-compliant TCP/IP stacks were (alphabetically) 3Com, Beame & Whiteside, DEC, Distinct, FTP Software, Frontier, IBM, Novell, Microdyne, NetManage, Sun Microsystems and Trumpet.

Trumpet Winsock, one of the few Winsock 1.0 implementations, was special in that it could be installed under Windows 3.0 which had no built-in support for Winsock. Trumpet was the most popular Winsock implementation for Windows 3.x due to its freeware status and extensive functionality.

Source

Originally adapted from: Aboba, Bernard D., comp.protocols.tcp-ip.ibmpc, Frequently Asked Questions, 1993. Usenet: news:news.answers. Thanks to http://www.foldoc.org.

See also