Can we write NTP server using c# - NTP

This is a discussion on Can we write NTP server using c# - NTP ; Hi, I m having code for ntp Client... But i want to wtite code for sever also.. can i write code for server...means is that possible or not...

+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 22

Thread: Can we write NTP server using c#

  1. Can we write NTP server using c#

    Hi,
    I m having code for ntp Client...
    But i want to wtite code for sever also..
    can i write code for server...means is that possible or not

  2. Re: Can we write NTP server using c#

    rajeshkankran@gmail.com wrote:
    > Hi,
    > I m having code for ntp Client...
    > But i want to wtite code for sever also..
    > can i write code for server...means is that possible or not


    I'm not aware of any compliant implementation of an NTP client that
    doesn't also include a server.

  3. Re: Can we write NTP server using c#

    On 2008-05-26, rajeshkankran@gmail.com wrote:
    > Hi,
    > I m having code for ntp Client...
    > But i want to wtite code for sever also..
    > can i write code for server...means is that possible or not


    If you are using The NTP Reference Implementation the only funtional
    difference between an "NTP Client" and an "NTP Server" is that the
    latter answers polls (i.e. time requests) from other systems. They both
    poll time sources (e.g. remote time servers os directly attached
    ref-clocks) and discipline the system clock.

    --
    Steve Kostecke
    NTP Public Services Project - http://support.ntp.org/

  4. Re: Can we write NTP server using c#

    rajeshkankran@gmail.com wrote:
    > Hi,
    > I m having code for ntp Client...
    > But i want to wtite code for sever also..
    > can i write code for server...means is that possible or not


    I'm not sure what your question really is. You can write in any language
    you want. Nothing prevents you doing that except maybe missing language
    constructs and most modern languages give you a way of creating your own.

    What's the real question?

    Danny

  5. Re: Can we write NTP server using c#

    "rajeshkankran@gmail.com" writes:

    >Hi,
    >I m having code for ntp Client...
    >But i want to wtite code for sever also..
    >can i write code for server...means is that possible or not


    Sure, but I suspect that since you ask the question, it is not possible for
    you. And why would you do so? You have a free version of ntp available that
    is already coded and debugged.


  6. Re: Can we write NTP server using c#

    rajeshkankran@gmail.com wrote:
    >
    > I m having code for ntp Client...
    > But i want to wtite code for sever also..
    > can i write code for server...means is that possible or not


    One basic rule about forum postings: although it is important to
    summarise the complete question in the subject, one should write the
    body as though the subject had not been seen; I completely missed the
    mention of C# when I first read this.

    C# is a Common Language Runtime, byte code language and therefore
    vulnerable to unexpected delays as a result of garbage collection. It
    therefore isn't a good choice of language for any timing sensitive
    application.

    Once you have an NTP client, as against an SNTP one, writing a server is
    a relatively trivial exercise. If C# is able to support a client, it
    can certainly support a server, as you only need read access to the
    clock, but a client needs both read and write access. It's this fact
    that makes people think you are not asking the question that you intended.

    Note that, without using platform invoke, you are not going to get
    particularly good resolution from the time on Windows.

    Basically, by using C# you are putting obstacles in your way, which are
    pointless, as there is a perfectly good native version of nptd, and it
    is free.

  7. Re: Can we write NTP server using c#

    David Woolley wrote:

    > Once you have an NTP client, as against an SNTP one, writing a server is
    > a relatively trivial exercise.


    That makes no sense. There is no such think as just an NTP client. An
    NTP client is both a client and a server.

    Danny

  8. Re: Can we write NTP server using c#

    Thanks for response....

    I m totally new for NTP.
    Actually i have code for ntp client...and i m using localhost as server as
    NTP is installed on my pc only.
    in order to get response i have not written code for server but still server
    responding to me and generating message because of NTP installed.
    then can u pls tell me Why should i write code for server...?
    Means what server should do if write code for that?because it is already
    responding to client with time stamp.

    On Mon, May 26, 2008 at 7:58 PM, Danny Mayer wrote:

    > rajeshkankran@gmail.com wrote:
    >
    >> Hi,
    >> I m having code for ntp Client...
    >> But i want to wtite code for sever also..
    >> can i write code for server...means is that possible or not
    >>

    >
    > I'm not sure what your question really is. You can write in any language
    > you want. Nothing prevents you doing that except maybe missing language
    > constructs and most modern languages give you a way of creating your own.
    >
    > What's the real question?
    >
    > Danny
    >




    --
    With Regards
    Rajesh Kankran
    Mb-919891674156

  9. Re: Can we write NTP server using c#

    "Danny Mayer" wrote in message
    news:483B6FC4.8090106@ntp.isc.org...

    > [...] There is no such think as just an NTP client. An
    > NTP client is both a client and a server.


    How do you figure that? At the IP level, a server is a process
    to which clients can connect to retrieve information or trigger
    some action. In that sense, an NTP server would be a server that,
    on request, will dish out time neatly wrapped in NTP packets.
    An NTP client would be a process that makes requests to a remote
    server and acts on the received information locally. A perfect
    fit, as I see it.

    So you must mean something else. The diagnostics that NTP nodes
    should really provide? Including a server module in every node
    is not strictly required for that; the information might be logged
    and thus still be available without waiting for information
    requests. Or simply the fact that UDP is connectionless?

    Groetjes,
    Maarten Wiltink



  10. Re: Can we write NTP server using c#

    Danny Mayer wrote:
    > David Woolley wrote:
    >
    >> Once you have an NTP client, as against an SNTP one, writing a server is
    >> a relatively trivial exercise.

    >
    > That makes no sense. There is no such think as just an NTP client. An
    > NTP client is both a client and a server.


    That makes no sense. My point is that, in practice, that is the case,
    so if he has third party code for a client, one would think he would
    have code for a server, already. However, it is fairly trivial to cut
    out the server code from the reference implementation and still have a
    working client. Simply ignoring client and symmetric packets will
    effectively disable the server function in ntpd.

    It's not clear whether his client is one he is written, whether it is
    actually in C#, and even whether it is really an NTP client at all.
    It's possible that he has some third party SNTP client code. Also,
    English obviously isn't his first language, which means you have to be
    careful not to assume that the literal interpretation is the only
    possible intended one.

    I think we've scared him off though, so we may never find what the real
    problem was and why the C# constraint existed. Although weird
    constraints are sometimes an indication of homework exercises, my gut
    feeling is this is more a case of corporate policy.

  11. Re: Can we write NTP server using c#

    rajeshkankran@gmail.com (Rajesh kankran) writes:

    >Thanks for response....


    >I m totally new for NTP.
    >Actually i have code for ntp client...and i m using localhost as server as
    >NTP is installed on my pc only.


    ?? This accomplishes what? Since your machine has no idea what the correct
    time is, why would you ask it for the correct time?

    >in order to get response i have not written code for server but still server
    >responding to me and generating message because of NTP installed.


    ?? Yes.

    >then can u pls tell me Why should i write code for server...?


    You should not. It is already written.

    >Means what server should do if write code for that?because it is already
    >responding to client with time stamp.


    >On Mon, May 26, 2008 at 7:58 PM, Danny Mayer wrote:


    >> rajeshkankran@gmail.com wrote:
    >>
    >>> Hi,
    >>> I m having code for ntp Client...
    >>> But i want to wtite code for sever also..
    >>> can i write code for server...means is that possible or not
    >>>

    >>
    >> I'm not sure what your question really is. You can write in any language
    >> you want. Nothing prevents you doing that except maybe missing language
    >> constructs and most modern languages give you a way of creating your own.
    >>
    >> What's the real question?
    >>
    >> Danny
    >>




    >--
    >With Regards
    >Rajesh Kankran
    >Mb-919891674156


  12. Re: Can we write NTP server using c#

    "Rajesh kankran" wrote in message
    news:e322cafe0805262112t2d574c0fr190455f9626096ea@ mail.gmail.com...

    > Actually i have code for ntp client...and i m using localhost as server
    > as NTP is installed on my pc only.


    So you would be trying to synchronise a host to itself?
    I foresee problems.


    > in order to get response i have not written code for server but still
    > server responding to me and generating message because of NTP installed.
    > then can u pls tell me Why should i write code for server...?
    > Means what server should do if write code for that?because it is already
    > responding to client with time stamp.


    The NTP system is designed to distribute known good time across a mesh or
    graph of connected machines. The starting points are (expected to be)
    'reference clocks', usually in UTC, and nodes further in the network are
    explicitly allowed to take time from several sources. Sources can be
    reference clocks if you have them (relatively few hosts do), or other
    nodes closer to reference clocks.

    The point is that distributing _known good_ time effectively requires every
    server to be a client as well, because that is the part where the clock in
    a given host is made to run 'better'.

    An additional point is that for monitoring purposes (_checking_ before you
    accept it as known good), almost every client[0] is allowed to also run as a
    server.

    Groetjes,
    Maarten Wiltink

    [0] 'Client' in the sense of 'not _intended_ as a server'. As may have
    become
    obvious, the distinction between clients and servers in NTP is blurry.




  13. Re: Can we write NTP server using c#

    Rajesh kankran wrote:
    >
    > I m totally new for NTP.
    > Actually i have code for ntp client...and i m using localhost as server as


    I still can't work out what you are actually doing and trying to do.
    You need to provide a lot more detail so that there is enough redundancy
    in the description that we can separate out the language issues from the
    the actual problem.

    > I m totally new for NTP.


    Why do you think you need NTP?

    What are you trying to achieve with it?

    What are the technical constraints (e.g. system is totally isolated in a
    screened room)?

    What are the policy constraints (e.g. non-negotiable choices of
    operating system or programming language)?

    What are the financial constraints (e.g. cannot buy reference clock
    hardware)?

    > Actually i have code for ntp client...and i m using localhost as
    > server as


    Where did you get this code from?

    If the source is not public (so we cannot look for ourselves), what
    specification does the code implement?

    Does it interface to the operating system (the normal case)?

    If not, in a fair amount of detail, how does it interface to your
    applications?

    Is this C# source code, source code in another language, or a binary.
    In principle, C# can run on operating systems other than Windows NT
    family ones, so what operating system(s) and what hardware are involved?

    Please explain how you can use localhost without running an NTP server
    on the machine. Note that the "local clock" as implemented in the
    reference implementation is of no value for clients as it simply means
    use the time that you already have. It only useful in servers (and only
    in special cases).

    If you are running a server on the local machine, ignoring that it is
    not a sensible thing to do, why cannot you also use that server code on
    a machine that is really acting as a server?

    > NTP is installed on my pc only.


    An NTP server is of no use unless there is a client on another machine.
    Please explain why you are asking about servers?

    > in order to get response i have not written code for server but still server
    > responding to me and generating message because of NTP installed.


    Both the reference implementation of NTP and W32Time implement both
    client and server functions. If you are actually running one of these,
    you already have a server. Note that many versions of W32Time are only
    SNTP implementations, not NTP ones.

    > then can u pls tell me Why should i write code for server...?


    Can you explain why you think that you might need to write one?
    (You might want to note that "u pls" is not proper English; it is mobile
    phone text message language. If you are actually fluent in English it
    gives the impression that you are not, and if you are not fluent, it
    makes it more difficult for people to understand. People will generally
    accept poor grammar and wrong choice of words where the writer is
    attempting to use a second language properly, but are less sympathetic
    when they deliberately use it wrongly.)

    > Means what server should do if write code for that?because it is already
    > responding to client with time stamp.


    Sounds like you already have a server. Note that it is very likely that
    Windows, in a business or academic environment, will be running W32Time,
    unless ntpd has been deliberately installed on it.

  14. Re: Can we write NTP server using c#

    On May 28, 3:33 pm, David Woolley
    wrote:
    > Rajesh kankran wrote:
    >
    > > I m totally new for NTP.
    > > Actually i have code for ntp client...and i m using localhost as server as

    >
    > I still can't work out what you are actually doing and trying to do.
    > You need to provide a lot more detail so that there is enough redundancy
    > in the description that we can separate out the language issues from the
    > the actual problem.
    >
    > > I m totally new for NTP.

    >
    > Why do you think you need NTP?
    >
    > What are you trying to achieve with it?
    >
    > What are the technical constraints (e.g. system is totally isolated in a
    > screened room)?
    >
    > What are the policy constraints (e.g. non-negotiable choices of
    > operating system or programming language)?
    >
    > What are the financial constraints (e.g. cannot buy reference clock
    > hardware)?
    >
    > > Actually i have code for ntp client...and i m using localhost as
    > > server as

    >
    > Where did you get this code from?
    >
    > If the source is not public (so we cannot look for ourselves), what
    > specification does the code implement?
    >
    > Does it interface to the operating system (the normal case)?
    >
    > If not, in a fair amount of detail, how does it interface to your
    > applications?
    >
    > Is this C# source code, source code in another language, or a binary.
    > In principle, C# can run on operating systems other than Windows NT
    > family ones, so what operating system(s) and what hardware are involved?
    >
    > Please explain how you can use localhost without running an NTP server
    > on the machine. Note that the "local clock" as implemented in the
    > reference implementation is of no value for clients as it simply means
    > use the time that you already have. It only useful in servers (and only
    > in special cases).
    >
    > If you are running a server on the local machine, ignoring that it is
    > not a sensible thing to do, why cannot you also use that server code on
    > a machine that is really acting as a server?
    >
    > > NTP is installed on my pc only.

    >
    > An NTP server is of no use unless there is a client on another machine.
    > Please explain why you are asking about servers?
    >
    > > in order to get response i have not written code for server but still server
    > > responding to me and generating message because of NTP installed.

    >
    > Both the reference implementation of NTP and W32Time implement both
    > client and server functions. If you are actually running one of these,
    > you already have a server. Note that many versions of W32Time are only
    > SNTP implementations, not NTP ones.
    >
    > > then can u pls tell me Why should i write code for server...?

    >
    > Can you explain why you think that you might need to write one?
    > (You might want to note that "u pls" is not proper English; it is mobile
    > phone text message language. If you are actually fluent in English it
    > gives the impression that you are not, and if you are not fluent, it
    > makes it more difficult for people to understand. People will generally
    > accept poor grammar and wrong choice of words where the writer is
    > attempting to use a second language properly, but are less sympathetic
    > when they deliberately use it wrongly.)
    >
    > > Means what server should do if write code for that?because it is already
    > > responding to client with time stamp.

    >
    > Sounds like you already have a server. Note that it is very likely that
    > Windows, in a business or academic environment, will be running W32Time,
    > unless ntpd has been deliberately installed on it.


    Thanks to u all..very much....

    It,s my fault that i m not clear about my problem...but u guys given
    me alot of info
    on NTP...

    Now i hv wriiten code for NTP server and client,,..and its not a big
    deal to make a ntp server..
    Thanks for your views again,,,,gentlemen

    With Regards..
    Rajesh

  15. Re: Can we write NTP server using c#

    Maarten Wiltink wrote:
    > "Danny Mayer" wrote in message
    > news:483B6FC4.8090106@ntp.isc.org...
    >
    >> [...] There is no such think as just an NTP client. An
    >> NTP client is both a client and a server.

    >
    > How do you figure that? At the IP level, a server is a process
    > to which clients can connect to retrieve information or trigger
    > some action.


    I'm not talking about the IP layer. I'm talking at the NTP layer.

    In that sense, an NTP server would be a server that,
    > on request, will dish out time neatly wrapped in NTP packets.
    > An NTP client would be a process that makes requests to a remote
    > server and acts on the received information locally. A perfect
    > fit, as I see it.
    >


    That is known as an SNTP client, not a NTP client.

    Danny

  16. Re: Can we write NTP server using c#

    David Woolley wrote:
    > Danny Mayer wrote:
    >> David Woolley wrote:
    >>
    >>> Once you have an NTP client, as against an SNTP one, writing a server is
    >>> a relatively trivial exercise.

    >> That makes no sense. There is no such think as just an NTP client. An
    >> NTP client is both a client and a server.

    >
    > That makes no sense. My point is that, in practice, that is the case,
    > so if he has third party code for a client, one would think he would
    > have code for a server, already. However, it is fairly trivial to cut
    > out the server code from the reference implementation and still have a
    > working client. Simply ignoring client and symmetric packets will
    > effectively disable the server function in ntpd.
    >
    > It's not clear whether his client is one he is written, whether it is
    > actually in C#, and even whether it is really an NTP client at all.
    > It's possible that he has some third party SNTP client code. Also,
    > English obviously isn't his first language, which means you have to be
    > careful not to assume that the literal interpretation is the only
    > possible intended one.
    >


    I know of no implementation which could be considered an NTP client
    only, just NTP implementations that are both client and server. There
    are, however, plenty of SNTP clients.

    Danny

  17. Re: Can we write NTP server using c#

    Rajesh kankran wrote:
    > Thanks for response....
    >
    > I m totally new for NTP.
    > Actually i have code for ntp client...and i m using localhost as server as
    > NTP is installed on my pc only.


    That makes no sense. You cannot use localhost here. You need to query a
    remote server. A client is looking for timestamps on a different server
    because it wants to get its local clock synchronized to the remote clock
    This is a major oversimplication but that's the general idea.

    > in order to get response i have not written code for server but still server
    > responding to me and generating message because of NTP installed.


    If you have NTP installed you don't need a client. The NTP server is
    keeping your clock synchronized. That's it's goal.

    > then can u pls tell me Why should i write code for server...?


    You shouldn't.

    > Means what server should do if write code for that?because it is already
    > responding to client with time stamp.
    >


    If you are already running an NTP server you don't need one.

    Danny

  18. Re: Can we write NTP server using c#

    Danny Mayer wrote:

    >
    > I know of no implementation which could be considered an NTP client


    That's also what I wrote.

    > only, just NTP implementations that are both client and server. There
    > are, however, plenty of SNTP clients.


    However, the person who started the thread claims to have written an NTP
    pure client, and that is perfectly possible to do. As it happens, I
    rather doubt that he has really written one. At best I think he has an
    SNTP client, and he may have a totally non-compliant one, but that is
    based on the level of knowledge demonstrated by the questions, not on
    actually having seen the code or a detailed design for it.

  19. Re: Can we write NTP server using c#

    Danny Mayer wrote:
    > Maarten Wiltink wrote:


    > In that sense, an NTP server would be a server that,
    >> on request, will dish out time neatly wrapped in NTP packets.
    >> An NTP client would be a process that makes requests to a remote
    >> server and acts on the received information locally. A perfect
    >> fit, as I see it.
    >>

    >
    > That is known as an SNTP client, not a NTP client.


    Not if it implements the full set of clock selection algorithms from
    NTP. It can be an NTP V3 client without even implementing the normal
    clock combining and discipline algorithms, as those are in non-normative
    appendixes.

    I doubt if the implementation here is NTP compliant, but such an
    implementation is possible.

  20. Re: Can we write NTP server using c#

    On May 31, 2:38 pm, David Woolley
    wrote:
    > Danny Mayer wrote:
    > > Maarten Wiltink wrote:
    > > In that sense, an NTP server would be a server that,
    > >> on request, will dish out time neatly wrapped in NTP packets.
    > >> An NTP client would be a process that makes requests to a remote
    > >> server and acts on the received information locally. A perfect
    > >> fit, as I see it.

    >
    > > That is known as an SNTP client, not a NTP client.

    >
    > Not if it implements the full set of clock selection algorithms from
    > NTP. It can be an NTP V3 client without even implementing the normal
    > clock combining and discipline algorithms, as those are in non-normative
    > appendixes.
    >
    > I doubt if the implementation here is NTP compliant, but such an
    > implementation is possible.


    Hi,

    What is the basic difference in NTP and SNTP implementation...

+ Reply to Thread
Page 1 of 2 1 2 LastLast