SYS/TYPES.H: Data type definition
Sys/socket.h: Provides socket functions and data structures
Netinet/in.h: Defining Data Structures sockaddr_in
Arpa/inet.h: provides IP address translation functions
Netdb.h: Provides functions for setting and retrieving domain names
Sys/ioctl.h: Provides functions for I/O control
Sys/poll.h: A function that provides a socket wait test mechanism
Other header files that are common in network programs
Unistd.h: Provides common functions for files, directories, programs, and process operations
Errno.h: Provides the definition of error number errno for error handling
Fcntl.h: Provides functions for file control
Time.h: Provides a function about time
Crypt.h: Provides cryptographic functions that use the DES encryption algorithm
Pwd.h: Provides functions for/etc/passwd file access
Shadow.h: Provides functions for/etc/shadow file access
Pthread.h: Functions that provide multithreaded operations
Signal.h: Provides functions for signal manipulation
Sys/wait.h, sys/ipc.h, sys/shm.h: functions that provide process waiting, interprocess communication (IPC), and shared memory
Recommendation: When writing a network program, you can directly use the following header file code
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <malloc.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <stdarg.h>
#include <fcntl.h>
#include <fcntl.h>
Include the following statement when it comes to user rights and password validation issues:
#include <shadow.h>
#include <crypt.h>
#include <pwd.h>
It should be noted that the cryptographic algorithm library should be linked at compile time, that is, the compiler option is increased:-lcrypt
involves file and time operations add the following statement:
#include <sys/time.h>
#include <utime.h>
#include <time.h>
#include <sys/stat.h>
#include <sys/file.h>
When it comes to multi-process operations, add the following statement:
#include <sys/wait.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <signal.h>
When it comes to multithreaded operations, add the following statement:
#include <pthread.h>
#include <sys/poll.h>
It should be noted that the compile-time link should be wired libraries, that is, the compiler option is increased:-lthread