Technical requirements

The example programs from this chapter can be compiled using any modern C compiler. We recommend MinGW for Windows and GCC for Linux and macOS. You also need to have the libssh library installed. See Appendix BSetting Up Your C Compiler on WindowsAppendix CSetting Up Your C Compiler on Linux, and Appendix DSetting Up Your C Compiler on macOS, for compiler setup and libssh installation.

The code for this book can be found at https://github.com/codeplea/Hands-On-Network-Programming-with-C.

From the command-line, you can download the code for this chapter by using the following command:

git clone https://github.com/codeplea/Hands-On-Network-Programming-with-C
cd Hands-On-Network-Programming-with-C/chap11

Each example program in this chapter runs on Windows, Linux, and macOS.

Each example needs to be linked against the libssh library. This is accomplished by passing the -lssh option to gcc.

We provide the exact commands needed to compile each example as it is introduced.

For brevity, we use a standard header file with each example program in this chapter. This header includes the other needed headers in one place. Its contents are as follows:

/*chap11.h*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <libssh/libssh.h>