火山PC【视窗】NTP协议同步时间

火山PCNTP协议同步时间

本文作者:灰羊羊

一、需要调用的模块

  1. 视窗基本类
  2. MFC界面基本类

二、火山代码的构建

  1.工具栏中点击文件---新建---项目---空白视窗程序--MFC窗口程序,创建解决方案,这里就不放图了

  2.引入上面所列的模块

  3..界面布局上放一个按钮就好了

  4.按钮事件,这里我们需要封装一个方法,NTP_取网络时间(参数1:NTP地址,参数2:NtpTimeAddress(小数类))

  4.按钮事件,这里我们需要封装一个方法,NTP_取网络时间(参数1:NTP地址,参数2:NtpTimeAddress(小数类))

4.常用的NTP服务器

国内常用

1.cn.pool.ntp.org
2.cn.pool.ntp.org
3.cn.pool.ntp.org
0.cn.pool.ntp.org
cn.pool.ntp.org
tw.pool.ntp.org
0.tw.pool.ntp.org
1.tw.pool.ntp.org
2.tw.pool.ntp.org
3.tw.pool.ntp.org

#NTP服务器
ntp1.aliyun.com
ntp2.aliyun.com
ntp3.aliyun.com
ntp4.aliyun.com
ntp5.aliyun.com
ntp6.aliyun.com
ntp7.aliyun.com
阿里云
#Time服务器
time1.aliyun.com
time2.aliyun.com
time3.aliyun.com
time4.aliyun.com
time5.aliyun.com
time6.aliyun.com
time7.aliyun.com

国内大学NTP服务器

ntp.sjtu.edu.cn 202.120.2.101 (上海交通大学网络中心NTP服务器地址)
s1a.time.edu.cn 北京邮电大学
s1b.time.edu.cn 清华大学
s1c.time.edu.cn 北京大学
s1d.time.edu.cn 东南大学
s1e.time.edu.cn 清华大学
s2a.time.edu.cn 清华大学
s2b.time.edu.cn 清华大学
s2c.time.edu.cn 北京邮电大学
s2d.time.edu.cn 西南地区网络中心
s2e.time.edu.cn 西北地区网络中心
s2f.time.edu.cn 东北地区网络中心
s2g.time.edu.cn 华东南地区网络中心
s2h.time.edu.cn 四川大学网络管理中心
s2j.time.edu.cn 大连理工大学网络中心
s2k.time.edu.cn CERNET桂林主节点
s2m.time.edu.cn 北京大学

四、GIF演示

猜你喜欢

转载自blog.csdn.net/qq1185907650/article/details/120103550