Unix Network Programming SRC

The source code repository:https://github.com/unpbook/unpv13e

Preparation

1
git clone https://github.com/unpbook/unpv13e

Configure the makefile for your system:

1
CC=gcc CFLAGS=-w CPPFLAGS=-w ./configure    

In archlinux, if you use ./configure directly, you will get Wimplicit compile error in the following steps.

Build the dependence library.

1
2
3
4
5
6
cd lib
make
cd ../libfree
make
cd ../libroute
make

You can test by using the sample program

1
2
3
cd ../intro
make daytimetcpcli
./daytimetcpcli 127.0.0.1

If you get error

1
connect error: Connection refused

You need to install xinetd, configure it and start the service

1
2
3
yay -S xinetd
nvim /etc/xinetd.d/daytime # set `disable` from `yes` to `no`
systemctl start xinetd

And run daytimetcpcli again, you will get something like

1
16 MAY 2024 14:09:07 CST

Then, you are all set.

Author

Chen Yulin

Posted on

2024-05-16

Updated on

2024-05-16

Licensed under

Comments