《Unix网络编程卷1-套接字联网API》第一个例子编译
2015-07-24 21:32
676 查看
第一个例子:一个简单的时间获取客户程序,利用GCC编译会出错,需要查看源码中的README文档。
下载源码 unpv13e解压,可看到README文档,打开可看到:
进入到unpv13e的目录中
1、$ ./configure 执行。会出现权限不够的提醒,用chmod 777 修改权限即可,然后执行通过
2、cd lib
make
通过
3、cd ../libfree
make
通过
4、接下来的两次make不是必须的,敲make。有可能编译不通过,我的只通过了 libroute,后一个未通过。
5、执行最后一步
cd ../intro
make daytimetcpcli
./daytimetcpcli 127.0.0.1
发现出错—–connect error: Connection refused
解决方法:
因为系统默认的daytime服务是关闭的,在这个目录下有一个daytimetcpsrv.c文件, 执行make,编译后执行daytimetcpsrv,即sudo ./daytimetcpsrv。它的功能就是开启本机的daytime服务,再次执行./daytimetcpcli 127.0.0.1 h会通过。
下载源码 unpv13e解压,可看到README文档,打开可看到:
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 ../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 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.
进入到unpv13e的目录中
1、$ ./configure 执行。会出现权限不够的提醒,用chmod 777 修改权限即可,然后执行通过
2、cd lib
make
通过
3、cd ../libfree
make
通过
4、接下来的两次make不是必须的,敲make。有可能编译不通过,我的只通过了 libroute,后一个未通过。
5、执行最后一步
cd ../intro
make daytimetcpcli
./daytimetcpcli 127.0.0.1
发现出错—–connect error: Connection refused
解决方法:
因为系统默认的daytime服务是关闭的,在这个目录下有一个daytimetcpsrv.c文件, 执行make,编译后执行daytimetcpsrv,即sudo ./daytimetcpsrv。它的功能就是开启本机的daytime服务,再次执行./daytimetcpcli 127.0.0.1 h会通过。
相关文章推荐
- 没有任何关闭socket的日志,客户端和服务端进程都在, 网络连接完好, 为什么进行某操作后好好的tcp连接莫名其妙地断了呢?
- 云计算和大数据时代网络技术揭秘(十五)大数据网络
- 从本地或者网络读取图片,并转换为Bitmap图片
- Http状态码的种类及含义
- HTTP、SIP都是基于文本的协议,他们和基于二进制的协议有什么区别?!
- java理论之java多线程与网络编程
- 黑马程序员——第六篇_网络编程
- HDU 5294 Tricks Device (最短路+网络流)
- 在Linux系统中使用iptraf进行网络监控
- C语言下,获取文件信息 http://qimo601.iteye.com/blog/1517413
- php如何获取http头信息
- 网络编程基础知识学习要点记录
- TCP/IP协议分析(推荐)
- Java如何从HttpServletRequest中读取HTTP请求的body
- php的curl获取https加密协议请求返回json数据进行信息获取
- nyoj-1084美丽的校园(二) 【线性规划】
- 【黑马程序员】----java基础----网络编程
- 使用hadoop distcp从ftp拷贝文件到hdfs
- http 获取手机号
- HTTP标头