/winsock-2.0

Unofficial source code repo for Lewis Napper's WinSock 2.0 (1997) book.

Primary LanguageCMIT LicenseMIT

WinSock 2.0 (1997) source code

Introduction

This is an unofficial source code repo for Lewis Napper's WinSock 2.0 (1997) book. The source code is reproduced here for reference (so you don't need to dig up the physical media of the book) and remains the copyright of the book authors.

Using this repository

To build, you'll need Visual Studio 2019 (any version) with the Desktop development with C++ workload installed. Some samples also use MFC, so you'll also need the C++ MFC for latest v142 build tools (x86 & x64) component installed.

Changes

I'm currently going through the code, restructuring the directories, and adding Visual Studio 2019 projects to build the projects (converted projects are listed below). As this is decades old Win32 code, I don't plan on fixing compiler or security warnings, but if you do copy any code from this repository, it's strongly advised you heed and understand these warnings.

Conversion status

The conversion effort is ongoing and will take some time. Items listed below are successfully converted samples.

Chapter Sample Conversion notes
2 Datagram client and server OK.
GetHTTP OK.
HostInfo OK.
WsVer OK.
Stream client and server OK.
4 Chekmail OK. Requires MFC.
5 Ping OK.
PingI OK.
6 SendMail OK. Disabled an MFC call to address compiler warning C4996.
Wsterm OK. Updated WSTERM.RC2 resource file.
7 EnumProt
  • The ws2dnet.h header, which defines types for the now defunct DECnet protocol suite, is no longer part of the Windows SDK. The references to ws2dnet.h and its types have been commented out.
  • After the conversion, the build process complained about a missing bitmap file bitmap1.bmp. I'm not sure what this file is about, and I can't find any reference to it in the repository, so I added a dummy bitmap to make the build happy.
  • The ordering of the inclusion of Windows.h and winsock2.h was changed to prevent redefinitions.
SelProto OK.
8 Services
  • The ws2dnet.h header, which defines types for the now defunct DECnet protocol suite, is no longer part of the Windows SDK. The references to ws2dnet.h and its types have been commented out.
  • Windows NT 4.0 (_WIN32_WINNT 0x400) is no longer supported by MFC, and so MFC would not build against this version. I've bumped the version to Windows 10.
  • Disabled an MFC call to address compiler warning C4996.
9 GetHttp2 OK. Changed main() signature.
GetHttp3 OK. Changed main() signature.
10 httpa OK. There's actually a bug in this sample where requesting for a file in the hosted directory causes a 404 due to an extraneous "/" being prepended to the file name -- I may eventually fix this.
11 httpmt OK.
12 🚧 In progress.

Additional resources