Click here to Skip to main content
Click here to Skip to main content

SNTP Client in C#

By , 27 Aug 2001
 
  • Download source files - 12 Kb
  • Download demo project - 5 Kb

    Sample Image - ntpclient.jpg

    Introduction

    Though not obvious, time synchronization is sometimes important. The best example is the Kerberos authentication protocol, which requires the resources to be synchronized within minutes or even seconds, but there are other situations as well. The Network Time Protocol (NTP) and its simplified form (SNTP) are widely used to synchronize network resources, due to their simplicity and effectiveness. There are many programs available that synchronize your PC's clock with that of a time server. Dimension 4 is my favorite.

    In case you need time synchronization embedded into your software, here is the C# alternative. It's simple, fast and integrates seamlessly with the .NET platform. There is a Java implementation of a NTP client by Michel Van den Bergh, but I don't have the URL anymore. Maybe Michel reads this and will send me a note.

    There are several time severs on the Internet and the list below contains those operated by NIST. If you need more, use a search engine.

    Name IP Address Location
    time-a.nist.gov 129.6.15.28 NIST, Gaithersburg, Maryland
    time-b.nist.gov 129.6.15.29 NIST, Gaithersburg, Maryland
    time-a.timefreq.bldrdoc.gov 132.163.4.101 NIST, Boulder, Colorado
    time-b.timefreq.bldrdoc.gov 132.163.4.102 NIST, Boulder, Colorado
    time-c.timefreq.bldrdoc.gov 132.163.4.103 NIST, Boulder, Colorado
    utcnist.colorado.edu 128.138.140.44 University of Colorado, Boulder
    time.nist.gov 192.43.244.18 NCAR, Boulder, Colorado
    time-nw.nist.gov 131.107.1.10 Microsoft, Redmond, Washington
    nist1.datum.com 209.0.72.7 Datum, San Jose, California
    nist1.dc.certifiedtime.com 216.200.93.8 Abovnet, Virginia
    nist1.nyc.certifiedtime.com 208.184.49.9 Abovnet, New York City
    nist1.sjc.certifiedtime.com 208.185.146.41 Abovnet, San Jose, California

  • License

    This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    About the Author

    Valer BOCAN
    Architect
    Romania Romania
    I am a software engineer based in Timișoara, Romania and currently hold the position of software architect for one of the largest companies in the world.
     
    I invented a dialect of the Forth programming language and implemented the first Forth compiler for the .NET platform. I reverse-engineered the communication protocol of some GPS trackers and wrote from scratch a vehicle tracking system that is currently used to track my two cars. I hold a PhD in computer science and I am the author of several papers and a book chapter. In the 90s I wrote several computer viruses in assembly language for my own research and I was the first to devise a technique to deter heuristic virus scanners. In short, a humble man.

    Sign Up to vote   Poor Excellent
    Add a reason or comment to your vote: x
    Votes of 3 or less require a comment

    Comments and Discussions

     
    Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
    You must Sign In to use this message board.
    Search this forum  
        Spacing  Noise  Layout  Per page   
    QuestionntpmemberMarziyeh Eslampanah15-May-12 5:35 
    how can I execute this program to sync my system whit internet time servers after execute?
    should I change this program or use dll Import?
    plz help me .I cant write & understand En good.
    GeneralThanks for the codememberM Daniel Engineering12-Apr-12 5:35 
    GeneralTimeoutsmembermalcomm11-Feb-11 22:55 
    GeneralRe: TimeoutsmemberRomain TAILLANDIER8-Dec-11 23:42 
    AnswerRe: TimeoutsmemberValer BOCAN8-Dec-11 23:56 
    GeneralRe: TimeoutsmemberRomain TAILLANDIER9-Dec-11 0:14 
    NewsGreat little helper, has a leakmemberbruceme10123-Feb-10 6:24 
    GeneralLicensememberCaptain Groovy4-Feb-10 14:00 
    GeneralRe: LicensememberValer BOCAN4-Feb-10 17:43 
    GeneralthanxmemberMurat DOGANCAY21-Feb-09 2:55 
    Generalhangs if no ipmemberwihe200818-Jul-08 19:27 
    GeneralRe: hangs if no ipmemberwihe200818-Jul-08 19:31 
    GeneralRe: hangs if no ipmemberwihe200818-Jul-08 20:55 
    Generalcommercial usememberharmjonker14-Jul-08 6:19 
    GeneralRe: commercial usememberValer BOCAN14-Jul-08 22:47 
    QuestionDaylight Time savingmemberXadhoomGrglblstr6-Apr-08 22:47 
    AnswerRe: Daylight Time saving [modified]memberGeoff Low (NZ)5-Jun-08 15:56 
    GeneralThe program blockmemberNanakiFire2-Apr-08 3:34 
    GeneralNTP in Compact FrameworkmemberIowaEric8-Jun-07 5:56 
    GeneralRe: NTP in Compact FrameworkmemberIowaEric24-Oct-07 15:51 
    GeneralRe: NTP in Compact Frameworkmemberbeimklabautermann3-Jun-10 5:38 
    GeneralNIce articlememberVikas Salvi3-Mar-07 2:21 
    AnswerRe: NIce articlememberNetDave25-Apr-07 6:48 
    GeneralExecution on Pocket PC EmulatormemberRashmi C13-Dec-06 1:16 
    GeneralGet Server timemembertry.kret8-Oct-06 17:14 
    AnswerRe: Get Server timememberValer BOCAN8-Oct-06 17:23 
    GeneralRe: Get Server timemembertry.kret8-Oct-06 17:49 
    GeneralRe: Get Server timemembertry.kret9-Oct-06 15:32 
    QuestionUrgent:- Implementation of the Network Time protocol (RFC 13905) in C++memberKulkarni Abhijit27-Jul-06 0:49 
    GeneralThanks!!memberMicah Wedemeyer23-Dec-05 4:24 
    GeneralUsing IP addresses rather than hostnamesmemberMrEyes27-May-05 5:46 
    GeneralNeed urgent HelpmemberPShweta6-Oct-04 23:59 
    GeneralRe: Need urgent HelpmemberValer BOCAN7-Oct-04 0:53 
    Generalminor bug : Peer clock precision calculationmemberEzekielDA10-Jun-04 11:40 
    GeneralRe: minor bug : Peer clock precision calculationmemberValer BOCAN14-Jun-04 6:02 
    GeneralDoesn't Run on WinXP Promembersandman_max4-May-04 2:36 
    GeneralRe: Doesn't Run on WinXP PromemberValer BOCAN14-Jun-04 6:04 
    GeneralDoesn't work with W2K servermemberrahulN19-Jan-04 22:29 
    GeneralRe: Doesn't work with W2K servermemberValer BOCAN3-Feb-04 0:20 
    GeneralWindows CE CompatibilitymemberRFID Chris4-Dec-03 5:59 
    GeneralJava implementation of a NTP client by Michel Van den Bergh,sussKavitha Gopal21-Oct-03 21:45 
    GeneralRe: Java implementation of a NTP client by Michel Van den Bergh,sussAnonymous29-Sep-05 6:25 
    GeneralServer Timeoutmemberwey978-Jul-03 5:42 
    GeneralRe: Server Timeoutmembernolazabal11-Nov-04 12:08 
    AnswerRe: Server Timeoutmemberjdn492927-Apr-06 10:31 
    GeneralRe: Server Timeoutmembersegato20-Jun-06 2:18 
    GeneralRe: Server Timeoutmemberdjlove24-Feb-09 22:52 
    AnswerRe: Server Timeoutmemberdazza19763-Mar-08 20:26 
    GeneralSuggestionmemberJeffrey Sax21-May-03 15:01 
    GeneralRe: Suggestionmemberdjlove24-Feb-09 22:48 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Permalink | Advertise | Privacy | Mobile
    Web01 | 2.6.130619.1 | Last Updated 28 Aug 2001
    Article Copyright 2001 by Valer BOCAN
    Everything else Copyright © CodeProject, 1999-2013
    Terms of Use
    Layout: fixed | fluid