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

SNTP Client in C#

, 27 Aug 2001 CPOL
Rate this:
Please Sign up or sign in to vote.
Implementation of the Simple Network Time Protocol (RFC 2030) in C#
  • Download source files - 12 Kb
  • Download demo project - 5 Kb

    Sample Image - ntpclient.jpg


    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 NIST, Gaithersburg, Maryland NIST, Gaithersburg, Maryland NIST, Boulder, Colorado NIST, Boulder, Colorado NIST, Boulder, Colorado University of Colorado, Boulder NCAR, Boulder, Colorado Microsoft, Redmond, Washington Datum, San Jose, California Abovnet, Virginia Abovnet, New York City 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
    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.

    Comments and Discussions

    GeneralRe: License PinmemberValer BOCAN4-Feb-10 18:43 
    Generalthanx PinmemberMurat DOGANCAY21-Feb-09 3:55 
    Generalhangs if no ip Pinmemberwihe200818-Jul-08 20:27 
    GeneralRe: hangs if no ip Pinmemberwihe200818-Jul-08 20:31 
    GeneralRe: hangs if no ip Pinmemberwihe200818-Jul-08 21:55 
    Generalcommercial use Pinmemberharmjonker14-Jul-08 7:19 
    GeneralRe: commercial use PinmemberValer BOCAN14-Jul-08 23:47 
    QuestionDaylight Time saving PinmemberXadhoomGrglblstr6-Apr-08 23:47 
    AnswerRe: Daylight Time saving [modified] PinmemberGeoff Low (NZ)5-Jun-08 16:56 
    GeneralThe program block PinmemberNanakiFire2-Apr-08 4:34 
    GeneralNTP in Compact Framework PinmemberIowaEric8-Jun-07 6:56 
    GeneralRe: NTP in Compact Framework PinmemberIowaEric24-Oct-07 16:51 
    GeneralRe: NTP in Compact Framework Pinmemberbeimklabautermann3-Jun-10 6:38 
    GeneralNIce article PinmemberVikas Salvi3-Mar-07 3:21 
    AnswerRe: NIce article PinmemberNetDave25-Apr-07 7:48 
    GeneralExecution on Pocket PC Emulator PinmemberRashmi C13-Dec-06 2:16 
    GeneralGet Server time Pinmembertry.kret8-Oct-06 18:14 
    AnswerRe: Get Server time PinmemberValer BOCAN8-Oct-06 18:23 
    GeneralRe: Get Server time Pinmembertry.kret8-Oct-06 18:49 
    GeneralRe: Get Server time Pinmembertry.kret9-Oct-06 16:32 
    QuestionUrgent:- Implementation of the Network Time protocol (RFC 13905) in C++ PinmemberKulkarni Abhijit27-Jul-06 1:49 
    GeneralThanks!! PinmemberMicah Wedemeyer23-Dec-05 5:24 
    GeneralUsing IP addresses rather than hostnames PinmemberMrEyes27-May-05 6:46 
    GeneralNeed urgent Help PinmemberPShweta7-Oct-04 0:59 
    GeneralRe: Need urgent Help PinmemberValer BOCAN7-Oct-04 1:53 
    Generalminor bug : Peer clock precision calculation PinmemberEzekielDA10-Jun-04 12:40 
    GeneralRe: minor bug : Peer clock precision calculation PinmemberValer BOCAN14-Jun-04 7:02 
    GeneralDoesn't Run on WinXP Pro Pinmembersandman_max4-May-04 3:36 
    GeneralRe: Doesn't Run on WinXP Pro PinmemberValer BOCAN14-Jun-04 7:04 
    GeneralDoesn't work with W2K server PinmemberrahulN19-Jan-04 23:29 
    GeneralRe: Doesn't work with W2K server PinmemberValer BOCAN3-Feb-04 1:20 
    GeneralWindows CE Compatibility PinmemberRFID Chris4-Dec-03 6:59 
    GeneralJava implementation of a NTP client by Michel Van den Bergh, PinsussKavitha Gopal21-Oct-03 22:45 
    GeneralRe: Java implementation of a NTP client by Michel Van den Bergh, PinsussAnonymous29-Sep-05 7:25 
    GeneralServer Timeout Pinmemberwey978-Jul-03 6:42 
    GeneralRe: Server Timeout Pinmembernolazabal11-Nov-04 13:08 
    AnswerRe: Server Timeout Pinmemberjdn492927-Apr-06 11:31 
    GeneralRe: Server Timeout Pinmembersegato20-Jun-06 3:18 
    GeneralRe: Server Timeout Pinmemberdjlove24-Feb-09 23:52 
    AnswerRe: Server Timeout Pinmemberdazza19763-Mar-08 21:26 
    GeneralSuggestion PinmemberJeffrey Sax21-May-03 16:01 
    GeneralRe: Suggestion Pinmemberdjlove24-Feb-09 23:48 
    GeneralChanged the client code PinmemberRamon Smits10-Apr-03 8:12 

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

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

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