当前位置:网站首页>How do I get the date and time from the Internet- How to get DateTime from the internet?
How do I get the date and time from the Internet- How to get DateTime from the internet?
2022-06-12 06:00:00 【Bustling city 】
problem :
How to get current date and time from internet or server using C#? How to use C# Get the current date and time from the Internet or server ?I am trying to get time as follows: I am trying to get time as follows :
public static DateTime GetNetworkTime (string ntpServer){ IPAddress[] address = Dns.GetHostEntry(ntpServer).AddressList; if (address == null || address.Length == 0) throw new ArgumentException("Could not resolve ip address from '" + ntpServer + "'.", "ntpServer"); IPEndPoint ep = new IPEndPoint(address[0], 123); return GetNetworkTime(ep);}I am passing server IP address as netServer , but it does not work properly. I will server IP Address as netServer , But it doesn't work .
Solution :
Reference resources : https://stackoom.com/en/question/R03v边栏推荐
- flex/fixed上中下(移動端)
- 肝了一个月的 DDD,一文带你掌握
- json-c常用API
- XML parameter schema, the same MTK SW version is compatible with two different sets of audio parameters
- Rtmp/rtsp/hls public network real available test address
- POI, easyexcel framework use
- E-book analysis
- [PowerShell] command line output and adding system environment variables
- [go] Viper reads the configuration file in the go project
- The application could not be installed: INSTALL_ FAILED_ TEST_ ONLY
猜你喜欢

三年磨一剑:蚂蚁金服的研发效能洞察实践

yolov5

Guns framework multi data source configuration without modifying the configuration file

肝了一個月的 DDD,一文帶你掌握

Es6-es11 learning

Quickly master makefile file writing

RTMP streaming +rtmp playback low delay solution in unity environment
![[untitled]](/img/75/599c5b13dd483fad50f73ddb431989.jpg)
[untitled]

Available RTMP and RTSP test addresses of the public network (updated in March, 2021)

How to split a row of data into multiple rows in Informix database
随机推荐
Leetcode-717. 1-bit and 2-bit characters (O (1) solution)
Laravel8 authentication login
MySQL master-slave, 6 minutes to master
XML parameter schema, the same MTK SW version is compatible with two different sets of audio parameters
Leetcode-1260. 2D mesh migration
R language homework (IV): GDP value analysis of Shanghai and Tokyo from 1997 to 2018
Niuke daily question -day1
Flex / fixed Upper, Middle and Lower (Mobile end)
flex/fixed上中下(移动端)
Introduction to redis high availability
Project technical structure
Project management and overall planning
Leetcode-1043. Separate arrays for maximum sum
CCF noi2022 quota allocation scheme
Nrf52832 custom services and features
R语言大作业(四):上海市、东京 1997-2018 年GDP值分析
Idea common configuration
Execute sh script to prompt "[[: not found" solution. The difference between Bash and sh
XML参数架构,同一MTK SW版本兼容两套不同的音频参数
数据库实验三:数据查询
