Book description
A comprehensive guide to programming with network sockets, implementing Internet protocols, designing IoT devices, and much more with C
Key Features
- Apply your C and C++ programming skills to build powerful network applications
- Get to grips with a variety of network protocols that allow you to load web pages, send emails, and do much more
- Write portable network code for Windows, Linux, and macOS
Book Description
Network programming enables processes to communicate with each other over a computer network, but it is a complex task that requires programming with multiple libraries and protocols. With its support for third-party libraries and structured documentation, C is an ideal language to write network programs.
Complete with step-by-step explanations of essential concepts and practical examples, this C network programming book begins with the fundamentals of Internet Protocol, TCP, and UDP. You'll explore client-server and peer-to-peer models for information sharing and connectivity with remote computers. The book will also cover HTTP and HTTPS for communicating between your browser and website, and delve into hostname resolution with DNS, which is crucial to the functioning of the modern web. As you advance, you'll gain insights into asynchronous socket programming and streams, and explore debugging and error handling. Finally, you'll study network monitoring and implement security best practices.
By the end of this book, you'll have experience of working with client-server applications and be able to implement new network programs in C.
The code in this book is compatible with the older C99 version as well as the latest C18 and C++17 standards. You'll work with robust, reliable, and secure code that is portable across operating systems, including Winsock sockets for Windows and POSIX sockets for Linux and macOS.
What you will learn
- 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
- Explore Simple Mail Transfer Protocol (SMTP) for electronic mail transmission
- Apply network programming to the Internet of Things (IoT)
Who this book is for
If you're a developer or a system administrator who wants to get started with network programming, this book is for you. Basic knowledge of C programming is assumed.
Table of contents
- Title Page
- Copyright and Credits
- Dedication
- About Packt
- Contributors
- Preface
- Section 1 - Getting Started with Network Programming
- Introducing Networks and Protocols
- Getting to Grips with Socket APIs
- An In-Depth Overview of TCP Connections
- Establishing UDP Connections
- Hostname Resolution and DNS
- Section 2 - An Overview of Application Layer Protocols
- Building a Simple Web Client
- Building a Simple Web Server
- Making Your Program Send Email
- Section 3 - Understanding Encrypted Protocols and OpenSSL
- Loading Secure Web Pages with HTTPS and OpenSSL
- Implementing a Secure Web Server
- Establishing SSH Connections with libssh
- Section 4 - Odds and Ends
- Network Monitoring and Security
- Socket Programming Tips and Pitfalls
- Web Programming for the Internet of Things
-
Answers to Questions
- Chapter 1, Introducing Networks and Protocols
- Chapter 2, Getting to Grips with Socket APIs
- Chapter 3, An In-Depth Overview of TCP Connections
- Chapter 4, Establishing UDP Connections
- Chapter 5, Hostname Resolution and DNS
- Chapter 6, Building a Simple Web Client
- Chapter 7, Building a Simple Web Server
- Chapter 8, Making Your Program Send Email
- Chapter 9, Loading Secure Web Pages with HTTPS and OpenSSL
- Chapter 10, Implementing a Secure Web Server
- Chapter 11, Establishing SSH Connections with libssh
- Chapter 12, Network Monitoring and Security
- Chapter 13, Socket Programming Tips and Pitfalls
- Chapter 14, Web Programming for the Internet of Things
- Setting Up Your C Compiler on Windows
- Setting Up Your C Compiler on Linux
- Setting Up Your C Compiler on macOS
-
Example Programs
- Code license
-
Code included with this book
- Chapter 1 – Introducing Networks and Protocols
- Chapter 2 – Getting to Grips with Socket APIs
- Chapter 3 – An In-Depth Overview of TCP Connections
- Chapter 4 – Establishing UDP Connections
- Chapter 5 – Hostname Resolution and DNS
- Chapter 6 – Building a Simple Web Client
- Chapter 7 – Building a Simple Web Server
- Chapter 8 – Making Your Program Send Email
- Chapter 9 – Loading Secure Web Pages with HTTPS and OpenSSL
- Chapter 10 – Implementing a Secure Web Server
- Chapter 11 – Establishing SSH Connections with libssh
- Chapter 12 – Network Monitoring and Security
- Chapter 13 – Socket Programming Tips and Pitfalls
- Chapter 14 – Web Programming for the Internet of Things
- Other Book You May Enjoy
Product information
- Title: Hands-On Network Programming with C
- Author(s):
- Release date: May 2019
- Publisher(s): Packt Publishing
- ISBN: 9781789349863
You might also like
book
Network Programming with Go
Go combines the best parts of many other programming languages. It’s fast, scalable, and designed for …
book
The Sockets Networking API: UNIX® Network Programming Volume 1, Third Edition
UNIX Network Programming, Volume 1: The Sockets Networking API, Third Edition "Everyone will want this book …
book
Hands-On System Programming with Linux
Get up and running with system programming concepts in Linux Key Features Acquire insight on Linux …
book
Hands-On System Programming with C++
A hands-on guide to making system programming with C++ easy Key Features Write system-level code leveraging …