UNIX网络编程之一、如何运行书籍自带源码

前言

最近在学网络编程,于是下了一本《UNIX网络编程第一卷:套接口API (第3版)》,书中的内容哦高写得很不错,但是毕竟是学代码,不试着调试调试怎么玩呢?但是书上列出的代码根本不好运行,于是百度以后,找到了这个地址:源码下载

拿到源码以后发现看不懂,不过幸好有README;

现在就是使用的问题了,我用的操作系统是Linux Mint17 (64bit),按理说是没有什么问题的;下面具体讲讲需要做的事情咯


正文

首先,解压源码,这里就放到主目录下了咯:wei@wei-Lenovo-G480:~/project/unixNet > tar -xvf unpv13e.tar.gz


接着,咱们先看看目录下的README文档咯:


QUICK AND DIRTY
===============

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.

Notice that all the source code assumes tabs every 4 columns, not 8.

简单明了,不过我在运行到

  make daytimetcpcli
的时候还是出了问题 connect error: Connection refused


这种情况说明服务器没有启动daytime服务!那Ubuntu如何启动,daytime服务呢?

sudo apt-get install xinetd
sudo vi /etc/xinetd.d/daytime( 把 disable = yes 改成 no就行了)
sudo /etc/init.d/xinetd restart

完美运行!!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值