/Hands-On-Network-Programming-with-C

Book Example Code for Hands-On Network Programming with C

Primary LanguageCMIT LicenseMIT

Hands-On Network Programming with C

Hands-On Network Programming with C

This is the code repository for Hands-On Network Programming with C, written by Lewis Van Winkle and published by Packt.

Learn socket programming in C and write secure and optimized network code

What is this book about?

Network programming, a challenging topic in C, is made easy to understand with a careful exposition of socket programming APIs. This book gets you started with modern network programming in C and proper usage of the relevant operating system APIs.

This book covers the following exciting features:

  • Uncover cross-platform socket programming APIs
  • Implement techniques for supporting IPv4 and IPv6
  • Understand how TCP and UDP connections work over IP
  • Discover how hostname resolution and DNS work
  • Interface with web APIs using HTTP and HTTPS
  • Acquire hands-on experience with the email protocol (SMTP)
  • Gain real-world expertise with practical network applications
  • Explore new approaches for the Internet of Things (IoT)

If you feel this book is for you, get your copy today!

Instructions and Navigations

Build Status Build status

This repo contains the code which accompanies the book "Hands-On Network Programming with C", written by Lewis Van Winkle. The code is released under the MIT license.

Unless otherwise noted, all programs will compile cleanly on Windows, Linux, and macOS, and as C or C++. Code is tested with MinGW and Visual Studio on Windows, gcc and clang on Linux and macOS.

Chapter 1

Chapter 2

Chapter 3

Chapter 4

Chapter 5

Chapter 6

  • chap06/web_get.c A minimal HTTP client which will download a web resource from a given URL.

Chapter 7

Chapter 8

Chapter 9

The examples in this chapter use OpenSSL. Be sure to link against the OpenSSL libraries when compiling (-lssl -lcrypto).

Chapter 10

The examples in this chapter use OpenSSL. Be sure to link against the OpenSSL libraries when compiling (-lssl -lcrypto).

Chapter 11

The examples in this chapter use libssh. Be sure to link against the libssh libraries when compiling (-lssh).

Chapter 12

This chapter doesn't include any example programs.

Chapter 13

Chapter 14

This chapter doesn't include any example programs.

Required Software

Following along with the code in this book requires that you to have access to a C compiler on a standard operating system. The example programs in this book were carefully tested on Windows, Linux, and macOS. They were tested using the gcc, clang, and Microsoft Visual Studio compilers. All of the code in this book will compile as either C or C++.

In addition, the code examples in Chapter 9, Loading Secure Web Pages with HTTPS and OpenSSL, and Chapter 10, Implementing a Secure Web Server, require that you have the OpenSSL library installed.

Chapter 11, Establishing SSH Connections with libssh, requires that the libssh library is installed.

Instructions for installing all of the require software are provided in the appendices. See Appendix B, Setting Up Your C Compiler On Windows, Appendix C, Setting Up Your C Compiler On Linux, and Appendix D, Setting Up Your C Compiler On macOS, for compiler setup. A complete list of the example programs provided is given in Appendix E, Example Programs.

No non-free software is required to follow along with any of the examples in this book.

Get to Know the Author

Lewis Van Winkle is a software programming consultant, entrepreneur, and founder of a successful IoT company. He has over 20 years of programming experience after publishing his first successful software product at age twelve. He has over 15 years of programming experience with the C programming language on a variety of operating systems and platforms. He is active in the open-source community and has published several popular open-source programs and libraries, many of them in C. Today, Lewis spends much of his time consulting, where he loves taking on difficult projects that other programmers have given up on. He specializes in network systems, financial systems, machine learning, and interoperation between different programming languages.

Suggestions and Feedback

Please contact me if you have any feedback or suggestions.