UNIX网络编程_1-源码下载及环境配置

配置环境

本人使用的环境为centos 7.2,所使用的配套书籍为UNIX,网络编程第三版
链接:https://pan.baidu.com/s/1soJqtB7FtXJrMS0bujuusw
提取码:8nom

源码下载及环境配置

本书所使用的全部源码均可在www.unpbook.com下载,本人也做了百度云存档
链接:https://pan.baidu.com/s/1TDnc0qpHqVVI47XdhQvSZw
提取码:957a

下载到Linux后下解压打开

tar -xzvf unpv13e.tar.gz

根据解压后的README文件进行相关环境的配置

    ./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 ../libroute # only if your system supports 4.4BSD style routing sockets
    make           # only if your system supports 4.4BSD style routing sockets
 
    cd ../libxti   # only if your system supports XTI 
    make           # only if your system supports XTI</span> 
  1. 如果在…/libfree目录下执行make命令的时候,出现错误:
inet_ntop.c: 在函数‘inet_ntop’中:
inet_ntop.c:60:9: 错误:实参‘size’与原型不符
 size_t size;
        ^
In file included from inet_ntop.c:27:0:
/usr/include/arpa/inet.h:64:20: 错误:原型声明
extern const char *inet_ntop (int __af, const void *__restrict __cp,

那么,只需将size_t size;改为socklen_t size;就可以了。

第一个简单的时间获取程序

cd /intro
make daytimetcpcli
./daytimetcpcli 127.0.0.1

出现响应

08 DEC 2018 16:43:12 CST

如果报错
connect error: Connection refused
则需要打开本地服务器的daytime 功能,操作过程如下:

yum install xinetd
vim /etc/xinetd.d/daytime-stream

在daytime-stream中把disable改成 no 的属性。
再重启xinetd即可

service xinetd restart
  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值