获取在德尔福的上网时间 [英] Get internet time in delphi

查看:65
本文介绍了获取在德尔福的上网时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从互联网获取时间和日期

i want to get time and date from internet

我使用以下代码

IdDayTime1.ReadTimeout := 5000;
IdDayTime1.Host := 'www.time.windows.com';
IdDayTime1.Port := 37     ;
Label1.Caption := IdDayTime1.DayTimeStr;

但是我得到了:套接字错误#11004

but i get : socket error # 11004

这是什么,我做错了什么

whats is this and what did i do wrong

我的互联网和其他设备都可以

推荐答案

DayTime 协议不是 NTP 协议。 DayTime 使用端口13,而不是端口37。 Time 协议,同样,它不是使用123(UDP)的NTP协议。我不知道time.windows.com是否支持 DayTime Time 协议,当今从可靠时间源获取时间的最常用协议是 <一个href = http://tools.ietf.org/html/rfc5905 rel = noreferrer> NTP 及其更简单的同级SNTP,它取代了DayTime和Time协议。

DayTime protocol is not the NTP protocol. DayTime uses port 13, not 37. 37 is used by the Time protocol, which, again, in not the NTP protocol, which uses 123 (UDP). I do not know if time.windows.com supports the DayTime and Time protocols, the most common used protocols to get time from a reliable time source nowadays is NTP, and its simpler sibling SNTP, which superseded both DayTime and Time protocols.

这篇关于获取在德尔福的上网时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆