Tcp Daytime获取客户端
daytime 服务
Linux系统可以开启daytime服务,让客户端通过13端口获取服务器的时间。这个服务并不是默认开启的,如果需要的话可以手动开启。
以CentOS 6系统为例,可以通过修改 /etc/xinetd.d/daytime-dgram 和 /etc/xinted.d/daytime-stream 两个文件来开启 Tcp 和 Udp 的 daytime服务。
# This is for quick on or off of the service
disable = no
将对应文件内的disable选项改为yes,然后通过命令
service xinetd restart
重启xinetd即可。
如果不存在路径 /etc/xinetd.d/ 可以通过命令
yum install xinetd
下载xinetd。
代码片段
int main(int argc,