当前位置:网站首页>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上中下(移動端)
- R语言大作业(四):上海市、东京 1997-2018 年GDP值分析
- nus_ data_ Handler source code interprets data types such as structure
- How much Ma is the driving current of SIM card signal? Is it adjustable?
- 从传统网络IO 到 IO多路复用
- [gpio] how to modify / display GPIO status through ADB shell
- Solution to the problem of the 80th fortnight competition of leetcode
- IO to IO multiplexing from traditional network
- Data integration framework seatunnel learning notes
- TCP and UDP introduction
猜你喜欢

MySQL 主从,6 分钟带你掌握

Project and build Publishing

TCP and UDP introduction

Chapter 7 - pointer learning

Leetcode simple problem: converting an integer to the sum of two zero free integers

EBook list page

GRP development: four communication modes of GRP

POI, easyexcel framework use

Identification of campus green plants based on tensorflow

Individual application for ov type SSL certificate
随机推荐
Guns framework multi data source configuration without modifying the configuration file
[Yu Yue education] basic reference materials of accounting of Nanjing Normal University
Un mois de DDD hépatique.
Leetcode-1663. Minimum string with given value
User login (medium)
Database Experiment 2: data update
Idea common configuration
User login 【 I 】
R language homework (IV): GDP value analysis of Shanghai and Tokyo from 1997 to 2018
Annotation configuration of filter
Error the main class com xxx. yyy. Application
What is the lszrz protocol used at ordinary times? Talk about xmodem/ymodem/zmodem
China's elastic belt market trend report, technical dynamic innovation and market forecast
[C language basics] macro definition usage
A preliminary understanding of function
Front desk display LED number (number type on calculator)
Leetcode-1043. Separate arrays for maximum sum
What is the difference between ArrayList and LinkedList?
数据库为什么不使用hash表?
E-book analysis
