加入收藏 | 设为首页 | 会员中心 | 我要投稿 站长网 (https://www.zhandada.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Unix > 正文

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

发布时间:2022-10-27 18:00:43 所属栏目:Unix 来源:转载
导读: UNIX网络编程—源码下载及环境配置
配置环境
本人使用的环境为centos 7.2,所使用的配套书籍为UNIX,网络编程第三版
链接:
提取码:8nom
源码下载及环境配置
本书所使用的全部源码均可在下

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

配置环境

本人使用的环境为centos 7.2,所使用的配套书籍为UNIX,网络编程第三版

链接:

提取码:8nom

源码下载及环境配置

本书所使用的全部源码均可在下载,本人也做了百度云存档

链接:

提取码: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> 

如果在…/libfree目录下执行make命令的时候unix网络编程,出现错误:

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

(编辑:站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章