分享

解决unix网络编程(第三版)的源代码编译的问题 -connect dennied

 just_person 2012-02-14

方案一:

到官方网站下载源代码,先看readme.里头教你怎么做的.

如果你用ubuntu的话,在测试课本第5页的程序时,可能会遇到一个情况,connect dennied.

那是因为你的daytime服务没有开。

具体解决方案在
http:///showthread.php?t=650791


摘录如下:
First, you'll need to install xinetd:
Code:
sudo aptitude install xinetd
Next you'll need to enable the daytime and echo services by editing their config files
in /etc/xinetd.d (you should only need to change the disable option from yes to no )

Finally tell xinetd to reload the configuration:
Code:
sudo invoke-rc.d xinetd reload
Note that by default, anyone will be able to connect to these services. You can (if you want),
restrict access to only allow connections from certain addresses, to disallow connections from
certain addresses, or to only accept connections from a specific network interface, by adding
only_from, no_access or bind options to the configuration files (have a look at the xinetd.conf man page
Code:
man xinetd.conf
for details on these and other configuration options).

方案二:
敲击./daytimetcpcli 127.0.0.1后发现报错,Connection Refused。上网google了一下解决了这个问题,原来是因为这个版本的系统默认是不开daytime服务的,而且开启daytime服务需要有 root权限,然后你会看到在相同的目录下有一个daytimetcpsrv.c文件,编译后执行它,注意需要有root权限,即sudo   ./daytimetcpsrv。它的功能就是开启本机的daytime服务,然后你再开启一个终端,敲击./daytimetcpcli 127.0.0.1后返回了你想要的结果

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多