unix网络编程卷1 时间获取客户端程序

在尝试unix卷1的例子时所遇到的问题,记录下来作为备忘。

http://bbs.chinaunix.net/archiver/tid-505577.html 

和http://chenliang.info/?p=224 
cd unpv12e 
./configure 
make 
vim README看怎么安装 
cd unpv12e/lib 
make会报错unp.h:114: error: redefinition of ‘struct in_pktin 
unp.h中,这段代码注释掉,因为在linux系统include文件中已经定义了这个结构, 
Java代码   收藏代码
  1. /* The structure returned by recvfrom_flags() */  
  2. struct in_pktinfo {  
  3.   struct in_addr    ipi_addr;    /* dst IPv4 address */  
  4.   int      ipi_ifindex;                  /* received interface index */  
  5. };  


cd ../libfree 
make 
inet_ntop.c:61: error: argument ’size’ doesn’t match prototype 
/usr/include/arpa/inet.h:153: error: prototype declaration 
在mac下为: 
Java代码   收藏代码
  1. apple:libfree apple$ make  
  2. gcc -I../lib -g -O2 -D_REENTRANT -Wall   -c -o in_cksum.o in_cksum.c  
  3. gcc -I../lib -g -O2 -D_REENTRANT -Wall   -c -o inet_ntop.o inet_ntop.c  
  4. inet_ntop.c: In function ‘inet_ntop’:  
  5. inet_ntop.c:61: error: argument ‘size’ doesn’t match prototype  
  6. /usr/include/arpa/inet.h:99: error: prototype declaration  
  7. make: *** [inet_ntop.o] Error 1  
  8. apple:libfree apple$  

inet_ntop.c第60行 size_t size ->改成 socklen_t size 

#cd ../intro 
#make 
#./daytimetcpsrv & 

#./daytimetcpcli 127.0.0.1 

得到错误:connect error: Connection refused

答案参考来自于:http://www.oschina.net/question/234345_42484?sort=time


那么是你的daytime服务没有开启!

我的是fedora,那么先看看有没有安装xinetd

yum install xinetd.

然后

7.进入 /etc/xinetd.d/daytime  有2个文件修改

disable yes 改为 disable no

重启 xinetd 服务就行了!
#service xinetd  restart   


这个时候再次

#./daytimetcpcli 127.0.0.1

看到成功显示时间


得到输出时间应该就表示安装初步成功了 .



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值