In order to complete the compilation first, the following steps are required:
1. Go to the Linux subdirectory and perform make. (This step is patching.) )
2, return to the previous level directory, open file simplec.c, add header file #include <stdio.h>.
3. Remove static from the static void set_address in the following file:
Connectto.c
Tcpsink.c
3. Perform make at the root directory.
Carries mistake one:
When doing Shutdownc/tcpecho experiments, the client SHUTDOWNC always outputs an error:
Shutdownc:fputs failed
It's completely different from what the book says about "server disconnected."
The relevant code is at line 50th SHUTDOWN.C:
if (Fputs (Lin, stdout))
Error (1, errno, "Fputs failed");
Look at Fputs's Man Handbook, you know:
Fputs () return a non-negative number on success, or EOF on error
So change to:
if (Fputs (lin, stdout) = = EOF ) 1 " Fputs failed " );
Recompile, then do the experiment, the output is consistent with the book:
Shutdownc:server disconnected
"TCP/IP high-efficiency programming: 44 Tips for improving network programs" source code compilation on Linux