© Copyright 1999 University of New Haven
The Winsock package consists of 3 files: winsock.h, winsock.lib and winsock.dll.
If your machine already has the Winsock files, then skip to Domain Names or IP Addresses below.
Click here to download a compressed file, winsock.exe containing files winsock.h and winsock.lib which I have successfully tested with MS Visual C++ 1.0 and Borland C++ 3.0. After downloading file winsock.exe:
The third file, winsock.dll, must be available on your local PC. It is not portable, but comes with your TCP/IP package, such as Windows for Workgroups 3.11 TCP/IP, Windows 95, NT or Trumpet Winsock. It should be somewhere in your path, or perhaps in \WINDOWS or \WINDOWS\SYSTEM.
If you wish to establish a connection to a machine which has an IP address, but not a domain name (e.g. a PC in the CS lab), instead of:
serverip = gethostbyname("charger.newhaven.edu");
you should use:
long ipaddr = inet_addr("18.104.22.168");
serverip = gethostbyaddr(&ipaddr, 4, PF_INET);
This situation can arise when you wish to connect to a server running on a Windows PC in the CS lab. The PC's IP address can be found in a MS-DOS environment variable named IP which is displayed by the MS-DOS set command.
General information about Winsock is available at Stardust, a repository for Winsock information.