Get the App
SLTechnology News&Howtos  ›  Servers  › 

UNIX network programming volume 2 source code use

Shulou Source: shulou.com Published: 2022-06-03 07:00:10 11月14日 Update

1. Download the source code, the home page of W. Richard Stevens: http://www.kohala.com/start/

Wget http://www.kohala.com/start/unpv22e/unpv22e.tar.gz-P / usr/local/src

two。 Decompression

Tar xvf / usr/local/src/unpv22e.tar.gz-C / root/bin

3. Compile library files

Cd / root/bin/unpv22e/./configure

Edit and generate the config.h file and comment on the following lines

Vi config.h56 / / # define uint8_t unsigned char / * * / 57 / / # define uint16_t unsigned short / * * / 58 / / # define uint32_t unsigned int / * /

Add MSG_R and MSG_W definition

Vi config.h66 / / add by jcq67 typedef unsigned long ulong_t;68 # define MSG_R 040069 # define MSG_W 0200

Add _ GNU_SOURCE definition

Vi config.h#define _ GNU_SOURCE

Compile warpunix.c and replace the mktemp function with the mkstemp function

Cd lib181 void182 Mktemp (char * template) 183 {184 if (mkstemp (template) = = NULL | | template [0] = = 0) 185 err_quit ("mktemp error"); 186}

Compile and generate libunpipc.a

Cd libmake

4. Build your own directory for writing code

Mkdir-p / root/bin/unpv2cd-cp / root/bin/unpv22e/libunpipc.a / root/bin/unpv22e/config.h / root/bin/unpv22e/Make.defines.

5. Compile your own files for each directory

Copy the * .h header files and Makfile files from each subdirectory, and then execute

Cp / root/bin/unpv22e/dir/*.h / root/bin/unpv22e/dir/Makefile / root/bin/unpv2

Make filename

You can compile the code in each subdirectory

Tags: Compilation files code functions subdirectories directories generation home page library files comments source code W. source code network network programming programming Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Technology Linux Microsoft Xiaomi