UNIX网络编程 第一卷:套接口API (第3版)
源码下载:http://www.ituring.com.cn/book/164?q=unix%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B
在Linux 下的使用
Linux也是UNIX,当然没问题!现在说明如何使用书本源码unpv13e.tar.gz的问题。
首先,解压源码
其后,阅读解压后目录unpv13e下的README文档!
QUICK AND DIRTY
===============
Execute the following from the src/ directory:
./configure # try to figure out all implementation differences
cd lib # build the basic library that all programs need
make # use "gmake" everywhere on BSD/OS systems
cd ../libfree # continue building the basic library
make
cd ../intro # build and test a basic client program
make daytimetcpcli
./daytimetcpcli 127.0.0.1
If all that works, you're all set to start compiling individual programs.
Notice that all the source code assumes tabs every 4 columns, not 8.
========================
最后运行:./daytimetcpcli 127.0.0.1
发现报错:connect error: Connection refused
这种情况说明服务器没有启动daytime服务!
Ubuntu启动daytime服务
1. sudo apt-get install xinetd
2. sudo vi /etc/xinetd.d/daytime, 将disable = yes改为no
3. sudo /etc/init.d/xinetd restart
运行如下:
zy@zy-ubuntu:~/unp/unpv13e/intro$ ./daytimetcpcli 127.0.0.1
28 FEB 2014 01:16:08 CST