unix网络编程卷1 时间获取客户端程序
2014-08-11 10:30
411 查看
在尝试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代码
/* The structure returned by recvfrom_flags() */
struct in_pktinfo {
struct in_addr ipi_addr; /* dst IPv4 address */
int ipi_ifindex; /* received interface index */
};
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代码
apple:libfree apple$ make
gcc -I../lib -g -O2 -D_REENTRANT -Wall -c -o in_cksum.o in_cksum.c
gcc -I../lib -g -O2 -D_REENTRANT -Wall -c -o inet_ntop.o inet_ntop.c
inet_ntop.c: In function ‘inet_ntop’:
inet_ntop.c:61: error: argument ‘size’ doesn’t match prototype
/usr/include/arpa/inet.h:99: error: prototype declaration
make: *** [inet_ntop.o] Error 1
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
看到成功显示时间
得到输出时间应该就表示安装初步成功了 .
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代码
/* The structure returned by recvfrom_flags() */
struct in_pktinfo {
struct in_addr ipi_addr; /* dst IPv4 address */
int ipi_ifindex; /* received interface index */
};
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代码
apple:libfree apple$ make
gcc -I../lib -g -O2 -D_REENTRANT -Wall -c -o in_cksum.o in_cksum.c
gcc -I../lib -g -O2 -D_REENTRANT -Wall -c -o inet_ntop.o inet_ntop.c
inet_ntop.c: In function ‘inet_ntop’:
inet_ntop.c:61: error: argument ‘size’ doesn’t match prototype
/usr/include/arpa/inet.h:99: error: prototype declaration
make: *** [inet_ntop.o] Error 1
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
看到成功显示时间
得到输出时间应该就表示安装初步成功了 .
相关文章推荐
- 一个简单的TCP客户端时间获取程序
- UNIX网络编程卷1 时间获取程序server UDP 协议无关
- 时间获取客户端程序遇到的问题
- UNIX网络编程卷1 时间获取程序客户端 TCP 协议相关性
- UNIX网络编程卷1 时间获取程序客户端 UDP 协议无关
- 获取客户端时间程序
- 织网的日子里——第一章:TCP时间获取之客户端和服务器端程序
- 一个简单的时间获取客户端程序
- 时间获取客户端程序TCP
- UNIX网络编程卷1 时间获取程序客户端 TCP 使用非阻塞connect
- 织网的日子里——第一章:TCP时间获取之客户端和服务器端程序
- 获取时间程序(客户端和服务器)
- 一个简单的TCP 客户端时间获取程序 ipv4/ipv6
- 不依赖客户端时间的倒计时js程序
- VC获取系统时间、程序运行时间
- 获取程序运行时间(精确到毫秒)
- ASP.net 获取客户端Ip和时间
- web程序获取客户端MAC地址
- C#2.0中获取程序的运行时间
- VC获取系统时间、程序运行时间