运行unix网络编程的的第一个例子
2012-07-06 20:09
411 查看
本文章使转载于博客:http://blog.csdn.net/zxremail/article/details/4858714为了以后自己查阅方便所以贴在本文中.
运行书本中的程序。
1,首先,进入到Stevens的主页中下载原码
2,然后,编译程序,方法如下:
tar -zxvf unpv12e.tar.gz (-C dir)//解压文件
cd unpv12e
./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 ../libgai # the getaddrinfo() and getnameinfo() functions
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 daytimetcpsrv
make daytimetcpcli
此时会生成 daytimetcpsrv daytimetcpsrv.o daytimetcpcli daytimetcpcli.o
3、linux现在因为安全问题,各个发行版本默认是不开daytime服务的。
第一个例子实际上是两个程序,客户端和服务端,你很有可能只运行了客户端,没有运行服务端程序。
服务端程序在书上第12页……你不会尚还没有看到那里吧?
PS:由于要打开端口,所以服务端程序需要用root权限执行,所以你可以先
sudo ./daytimetcpsrv (如果本身就是root就不需要sudo)
然后再开一个终端运行 ./daytimetcpcli 127.0.0.1 就可以看到返回的时间了.
运行书本中的程序。
1,首先,进入到Stevens的主页中下载原码
2,然后,编译程序,方法如下:
tar -zxvf unpv12e.tar.gz (-C dir)//解压文件
cd unpv12e
./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 ../libgai # the getaddrinfo() and getnameinfo() functions
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 daytimetcpsrv
make daytimetcpcli
此时会生成 daytimetcpsrv daytimetcpsrv.o daytimetcpcli daytimetcpcli.o
3、linux现在因为安全问题,各个发行版本默认是不开daytime服务的。
第一个例子实际上是两个程序,客户端和服务端,你很有可能只运行了客户端,没有运行服务端程序。
服务端程序在书上第12页……你不会尚还没有看到那里吧?
PS:由于要打开端口,所以服务端程序需要用root权限执行,所以你可以先
sudo ./daytimetcpsrv (如果本身就是root就不需要sudo)
然后再开一个终端运行 ./daytimetcpcli 127.0.0.1 就可以看到返回的时间了.
相关文章推荐
- 运行 Unix网络编程 中的第一个例子 unp学习 实例的运行
- 运行 Unix网络编程 中的第一个例子 unp学习 实例的运行
- 运行 Unix网络编程 中的第一个例子 unp学习 实例的运行
- 运行 Unix网络编程 中的第一个例子 时间日期例子
- unp.h的配置以及运行 Unix网络编程中的第一个例子
- AR之路--artoolkit5让第一个例子运行起来
- Unix网络编程第一卷(第三版) 第一个程序运行成功
- Struts2的学习笔记1配置运行环境运行第一个例子Hello word!
- 运行apue (unix 环境高级编程)第一个例子
- 《UNIX网络编程》中第一个timer_server的例子
- 创建第一个JBPM6项目并且运行自带的helloword例子(JBPM6学习之三)
- ubuntu下运行第一个小例子——wordcount
- 在本地(Eclipse)运行第一个strom-starter例子
- 学习ThinkPHP3.2.2(一):记录一下第一个例子的运行过程
- unix网络编程(一)第一个例子
- Fuck libev (1) 第一个可运行例子
- ogre 第一个例子编译运行
- 成功运行RMI的第一个例子
- [置顶] Activity工作流(2)-入门安装运行第一个例子
- 寒江独钓前辈的第一个例子的编译运行过程