unix网络编程第三版源码ubuntu下配置的问题解决

第一步:首先下载本书配套的源代码unpv13e.tar.gz

第二步:解压后进入根目录有一个README

4	Execute the following from the src/ directory:
     5	
     6	    ./configure    # try to figure out all implementation differences
     7	
     8	    cd lib         # build the basic library that all programs need
     9	    make           # use "gmake" everywhere on BSD/OS systems
    10	
    11	    cd ../libfree  # continue building the basic library
    12	    make
    13	
    14	    cd ../libroute # only if your system supports 4.4BSD style routing sockets
    15	    make           # only if your system supports 4.4BSD style routing sockets
    16	
    17	    cd ../libxti   # only if your system supports XTI
    18	    make           # only if your system supports XTI
    19	
    20	    cd ../intro    # build and test a basic client program
    21	    make daytimetcpcli
    22	    ./daytimetcpcli 127.0.0.1
    23	
    24	If all that works, you're all set to start compiling individual programs.

第三步:因为我的是ubuntu,因此执行上面的6 8 9 11 12

即在根目录下执行

./configure

然后

 cd lib
make 
在进入libfree 执行make

cd ../libfree
make
第四步(很重要):

cp ./lib/unp.h /usr/include/
cp ./config.h /usr/include/

然后进入intro编译第一个程序即可

 cd ../intro    
make daytimetcpcli
 ./daytimetcpcli 127.0.0.1
发现报错:connect error: Connection refused
这种情况说明服务器没有启动daytime服务!

第五步:

启动daytime服务


sudo apt-get install xinetd

sudo vi /etc/xinetd.d/daytime 将disable =yes改为no

然后重启并运行程序即可看到结果:

/etc/init.d/xinetd restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service xinetd restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop xinetd ; start xinetd. The restart(8) utility is also available.
xinetd stop/waiting
xinetd start/running, process 21975
root@wl-Lenovo-B590:/myworkspace/unixnetwork/unpv13e/intro# ./daytimetcpcli 127.0.0.1
18 APR 2014 14:03:08 CST



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值