Chapter 1
Chapter 2 TCP
Server passive open (passive open): Socket, bind, listen. The client is actively opened via the socket, connect (active open). Accept and connect are blocked
UDP UDP can be a full-duplex Chapter 3 - byte sort function
Low-order bytes are stored in the start Address: small End (Little-endian) byte order; high-order bytes are stored in the start address: big-endian (Big-endian) byte order. The Internet protocol uses big-endian byte-order to transmit these multibyte integers.
byte manipulation functions
#include <string.h>
//Set the specified number of bytes in the destination byte string to c
void *memset (void *dest, int c, size_t len);
Moves the specified number of bytes from the original byte to the target string
void *memcpy (void *dest, const void *SRC, size_t nbytes);
Compare byte strings, return the same 0
int memcpy (const void *ptrl, const void *PTR2, size_t nbytes);
Readn, writen, ReadLine functions
A byte-stream socket call read or write input or output may have fewer bytes than requested, however this is not a faulted state because the buffer used for sockets in the kernel has reached its limit.
Text line-based network protocol: SMTP, HTTP, FTP, etc. Chapter 4
fork and EXEC functions
#include <unistd.h>
//child process returns 0, the parent process returns the child process ID
pid_t fork (void);
Exec replaces the current process image with a new program file, the process ID is unchanged
The 6 exec functions are different:
Concurrent Server Profiles
Why does the parent process call close to CONNFD does not terminate its link to the customer? Because each file or socket has a reference count:
Most TCP servers are concurrent, and they derive a child process for each pending client link call fork. Most UDP servers are iterative.