### Technical Briefing

August, 1996

# The Winsock Interface

## Introduction

WinSock, short for Windows Sockets, is a common interface between Microsoft Windows programs and TCP/IP: it enables Windows programs from different vendors to access TCP/IP and thereby communicate over the network. The interface was originally designed in 1991 as the result of a collaboration between a group of TCP/IP stack vendors and application developers. It was based on the Berkeley Sockets interface for Unix TCP/IP stacks, but because it was designed for Windows the new interface had to be suitable for a non-preemptive multitasking operating system.

Although WinSock presents a common interface to Windows programs, different implementations of it are required for each TCP/IP stack. Windows 95 and Windows NT ship with their own TCP/IP stack and their own implementation of WinSock. Windows 3.1, however, requires an implementation of WinSock that is written for a specific vendor's TCP/IP stack. In most cases the DOS TCP/IP stack and the implementation of WinSock will be supplied by the same vendor.

Many different implementations of WinSock exist, and many popular programs use WinSock, including, Netscape Navigator, Telnet and FTP programs, and X-Windows server programs such as Exceed and PCXWare.

## The interface between a Windows program and the network

The following diagram shows the position of WinSock in relation to user software and network protocols. The user software communicates directly with WinSock, and WinSock translates its commands to the TCP/IP stack. Typical commands are for TCP/IP to set up connections to other stations and then to receive and transmit data.

## Running WinSock

For a Windows application to be able to find WinSock, the WinSock implementation has to be called WINSOCK.DLL. (The DLL extension stands for Dynamic Link Library.) Each implementation of WinSock is tied to a particular vendor's TCP/IP stack. In most cases, the TCP/IP vendor supplies the implementation of WinSock appropriate to its TCP/IP stack. It is important to remember that, even though all implementations of WinSock have the same name, they cannot be interchanged.

WinSock users often have more than one version of WinSock on a system. When this happens they can inadvertently run the wrong version. To prevent this, make sure you have only one version (the correct version for your TCP/IP stack) of WINSOCK.DLL in your current directory, on the path, in the \WINDOWS directory, or in the \WINDOWS\SYSTEM directory.

## WinSock 2

Work is now in progress by the WinSock Group on a new WinSock specification called WinSock 2. This new interface will support other transport mechanisms, such as Novell's IPX and SPX, as well as TCP/IP. Winsock 2 will also include support for Quality of Service allowing appications to specify their network requirements (including the amount of bandwidth they need). Implementations of WinSock 2 are currently available for Windows 95 and Windows NT version 4.0.

## Further information

For further information about different specifications of WinSock, refer to the following World-wide Web sites:

- Stardust - http://www.stardust.com
- North Carolina University -http://www.sunsite.unc.edu/WinSock

For shareware versions of applications written for WinSock version 1.1, refer to the following World-wide Web sites:

- www.stroud.com
- www.csapps.com