UNP例子运行

来源:互联网 发布:sqrt在c语言中意思 编辑:程序博客网 时间:2024/06/11 10:26

运行书本中的程序。
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

 

到现在就配置好了环境了,后面要试验哪个例子,就到那个目录下(书上所标志),make name

下面是第一个例子,时间例子:

 

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

    make daytimetcpcli

此时会生成 daytimetcpsrv daytimetcpsrv.o daytimetcpcli daytimetcpcli.o

原创粉丝点击