Windows Sockets is an API used for sending and receiving data on a network. Originally designed as the top-level interface for TCP/IP network transport stacks, the Windows Sockets API provides a standard Windows interface to many transports with different addressing schemes, including, for example, TCP/IP and IPX.
Windows Sockets specifies a programming interface based on the "socket" interface from the University of California at Berkeley. It includes a set of extensions designed to take advantage of the message-driven nature of Microsoft Windows. Windows Sockets is an open, industry-standard specification and Microsoft is one member of the group that originally defined Windows Sockets.
There are many Windows Sockets programs available. A number of the utilities that ship with Windows NT are Windows Sockets – based; for example, the DHCP client/server program.
Note
Windows NT version 4.0 implements 32-bit Windows Sockets version 2.0. Earlier versions of Windows NT implemented 32-bit Windows Sockets version 1.1. See Appendix D, "Windows Sockets," for a list of Microsoft and other Internet sites from which you can receive Windows Sockets specifications.
Windows Sockets programs generally use the gethostbyname() call to resolve a host name to an IP address. The gethostbyname() call uses the following (default) name lookup sequence:
1. Check local computer host name.
2. Check the HOSTS file for a matching name entry.
3. If a DNS server is configured, query it.
4. If no match is found, try the NetBIOS name resolution.
Some programs use the gethostbyaddr() call to resolve an IP address to a host name. The gethostbyaddr() call uses the following sequence:
1. Check local computer host name.
2. Check the HOSTS file for a matching address entry.
3. If a DNS server is configured, query it.
4. If no match is found, send a NetBIOS Adapter Status Request to the IP address being queried, and if it responds with a list of NetBIOS names registered for the adapter, parse it for the computer name.
The Windows Sockets API has been extended to provide support for IP multicasting. The extensions, and a sample program, party.exe, that illustrates usage, are available from ftp.microsoft.com. IP multicasting is currently supported only on AF_INET sockets of type SOCK_DGRAM.
Windows Sockets server programs generally create a socket and then use listen() to listen on it for connection requests. One of the parameters passed when calling listen() is the backlog of connection requests that the program would like Windows Sockets to queue for it.
Windows NT Server version 4.0 allows a backlog maximum of 200. Windows NT Workstation version 4.0 supports only a maximum allowable value of 5.
Note
Earlier versions of Windows NT based on the Windows Sockets 1.1 specification used the specified maximum allowable value (5) for backlog.
FTP or Web servers that are heavily used may benefit from increasing the backlog to a larger number than the default. Microsoft Internet Information Server allows the backlog parameter to be specified by using a registry setting.
By default, Windows NT versions 4.0 and 3.5x complete a recv() call when:
If a client program is run on a computer with a TCP/IP implementation that does not set the PUSH bit on sends, response delays may result. It's best to correct this on the client side; however, a configuration parameter (IgnorePushBitOnReceives) is added to Afd.sys to force it to treat all arriving packets as though the PUSH bit were set.