Book Example Code for Hands-On Network Programming with C
Book Example Code for 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
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:
If you feel this book is for you, get your copy today!
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.
select(). Echos received data back to client in all upper-case.fork() instead of select(). (Linux and macOS only)recvfrom() to receive one UDP packet.sendto() to send one UDP packet.select().getaddrinfo() to lookup addresses for a given hostname.The examples in this chapter use OpenSSL. Be sure to link against the OpenSSL
libraries when compiling (-lssl -lcrypto).
The examples in this chapter use OpenSSL. Be sure to link against the OpenSSL
libraries when compiling (-lssl -lcrypto).
The examples in this chapter use libssh. Be sure to link against the libssh libraries when compiling (-lssh).
This chapter doesn't include any example programs.
connect() call early.SO_REUSEADDR.send().send().select() can handle.This chapter doesn't include any example programs.
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.
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.
Please contact me if you have any feedback or suggestions.
No open issues yet, or sync has not completed.