9 Apr 1995

WINSOCK

Socket and Plug

Back in the dark ages of computing (a few years ago) many different programmers developed Internet software for personal computers. In those unenlightened days there were no standards. Each package developed its own interface between its own FTP utility and the rest of the Internet software. Everyone reinvented the basic set of tools, and there was no time left for more sophisticated programming.

As Windows became more popular, the limits of the old programs became clear. For programs to run correctly in Windows, they need to cooperate and obey common rules. Microsoft joined the other Internet software developers to produce a common interface between Internet applications and the internal system network software. This interface is called Windows Sockets, or WINSOCK.

The original "sockets" interface was developed for Berkeley (BSD) Unix. This, in turn, set the standard for most Internet software. OS/2 supports the BSD interface, but Windows 3.1 does not have the features of the more advanced operating systems. Each Windows program waits for events that signal a mouse click, key press, or other user operation. WINSOCK became a compromise that preserved much of the BSD "socket" conventions but made it Windows-ish by integrating network events into the same structure that handled mouse events.

WINSOCK unbundles the low level network programming from the high level application programming. Microsoft builds WINSOCK support into Windows NT 3.5 and Windows 95 (Chicago). WINSOCK support can be added to Plain Old Windows 3.1 with packages available from IBM, Microsoft, Novell, FTP Software, Netmanage, Spry, and many other firms. There is also a very popular shareware package called Trumpet WINSOCK.

Separately, programmers can produce application programs that use the WINSOCK interface. Terminal emulators, E-mail systems, Web browsers, file transfer utilities, search engines, news readers, and print spoolers can be written independently of the underlying communications software.Before WINSOCK, one vendor supplied the communications programming and the applications. Unfortunately, the vendor with a good E-mail package might have a poor terminal emulator and no Gopher client. WINSOCK allows the customer to choose each application independently.

One Interface, many Products

Each vendor supplies their own version of the WINSOCK function in the form of a module names WINSOCK.DLL. All of the WINSOCK.DLL modules perform the same function, but each is different depending on how the rest of the network support was designed.

The first generation of TCP/IP products were designed to support DOS programs. The support for the Ethernet adapter and the Internet TCP/IP protocols resided down in the DOS 640K area. Generally, this removed 100K from the amount of storage available for the largest DOS program. As Windows started to become popular, a very small WINSOCK.DLL module would allow Windows application programs to use the real Internet support code that resided in DOS memory. The old Microsoft and PC/TCP packaged were designed this way.

In this environment, the WINSOCK.DLL receives requests from a Windows program and repackages them as calls to the real TCP/IP support residing in DOS routines. The network interface is shared between DOS and Windows programs.

After Windows became popular, a few companies built Internet code that ran only within the Windows environment. A small stub of code had to reside in DOS memory to support the LAN adapter. The rest of the code resides in memory outside the DOS 640K and, therefore, has no effect on the size of DOS programs. Netmanage Chameleon and Trumpet WINSOCK are packaged this way.

In this environment, nearly the entire network and Internet support is packaged inside the WINSOCK.DLL module and its immediate helpers. There is no Internet access for DOS programs.

There is some system overhead switching between DOS and Windows mode. A more sophisticated option for Windows 3.1 and beyond is to package support in something called a VxD. Like the DLL modules, a VxD resides in Windows memory outside the DOS 640K area. However, a VxD is part of the Windows system supervisor and is more closely tied to the real memory and devices. The new Microsoft Internet support (code named "Wolverine") was written this way and is a free upgrade to Windows for Workgroups 3.11.

In this environment, the WINSOCK.DLL module receives requests from the Windows application programs and transfers them to the special Windows System environment in which VxD routines operate. Most of the logic resides inside the VxD routine.

In advanced operating systems, such as OS/2 3.x and Microsoft Windows NT, the older 16-bit Windows applications run in a Virtual Machine. The old Windows program see what appears to be a standard PC running plain old Windows 3.x. However, this is just a simulation being managed within part of the larger real operating system.

In this environment, WINSOCK.DLL is a dummy routine that transfers every request to the external operating system. Old Windows programs share the network with new 32-bit, multitasking programs that run under OS/2 or NT.

These are four separate cases with four separate WINSOCK.DLL modules. All of the WINSOCK modules supply a standard set of services. The same application programs can run in all four systems. However, the internal structure of the WINSOCK routine is entirely different in each case. Move a WINSOCK.DLL module from one system to another, and it will be looking for a DOS resident routine, VxD, or OS/2 system that does not exist in the other environment.

Continue Back PCLT

Copyright 1995 PC Lube and Tune -- Windows on the World -- H. Gilbert