unix网络变成编译问题

刚开始学习《UNIX网络编程》这本书,摸索了很久才知道怎么用源码。。写下来。。

1.第一个例子用需要 daytime服务,UBUNTU默认没有开启这个服务。。要先开启。

参考:http://ubuntuforums.org/showthread.php?t=650791

说明:先执行sudo aptitude install xinetd,然后修改其配置文件,进入etc/xinetd.d,把daytime和echo服务的disable选项的yes改为NO, 然后执行sudo invoke-rc.d xinetd reload,让xinetd重新载入配置文件。这样就OK了。

         PS:网上说可以编译执行书的服务器端程序就可以了,这个没试过,有兴趣的网友可以试试。

2.官网我进不去了,所以源码是在百度上搜到下载的。。

    cd unpv13e  //进入源码目录

     ./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   这个不一定执行成功,不成功可以54

    cd ../libxti   # only if your system supports XTI

    make           # only if your system supports XTI  这个不一定执行成功,不成功可以54

    cd ../intro    # build and test a basic client program

    make daytimetcpcli

    ./daytimetcpcli 127.0.0.1(本机)

    如果成功就会返回  08 JUL 2010 16:03:30 CST

    以后就可以用make指令测试其他源码
3.如果要用gcc指令的,就要把unpv13e/cofig.h和unpv13e/lib/unp.h拷贝到/usr/include里面。同时修改unp.h,把include ",,/configure"语句改为include ",/configure"。用gcc时,要把unpv13e/lib/error.o一起编译,提供err开头的一些错误函数的定义。

2010.7.10补:由于找不到那些包裹函数的代码,所以还是只能乖乖的用make编译源代码。。用gcc的话还是不行..

posted @ 2010-11-29 18:31  elite_lcf  阅读(400)  评论(0编辑  收藏  举报
知识共享许可协议
本博客采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。