|
-
Nov 7th, 2008, 04:10 PM
#1
Thread Starter
Junior Member
Connecting to NTP Server (VB6 Winsock)
I'm having a hard time figuring this one out. It could be that I don't know much about UDP, though I did manage to write a simple chat program a while ago.
The only information I've been able to find is that the NTP server uses UDP Port 123. What I can't seem to find is how to actually get the information from the server (I'll worry about decoding it later).
I was able to easily use the old TIME servers, connecting on TCP port 37, and automatically getting the data back, but not having so much luck here.
I did try sending some random data ("Test" or something), hoping that would trigger some data to come back at me, but no luck.
:s
Thanks for reading and hopefully helping
-
Nov 8th, 2008, 11:34 AM
#2
Re: Connecting to NTP Server (VB6 Winsock)
As you can see at http://en.wikipedia.org/wiki/Network_Time_Protocol NTP is not something you can implement as a simple client based on request/response transactions. Clients are normally implemented as a service, often a kernel service because if you need time precision at this level your code has to run with very high priority.
The actual mechanism is explained in a number of RFCs (see links at the page I linked to above). It is a complicated process because it attempts to discover and correct for network delays which are variable over time.
You might look at SNTP as a starting point if you truly want to play with this.
Edit:
No, there is no "connecting" since NTP is a UDP protocol.
See SNTPClient UserControl for a working solution.
Last edited by dilettante; Dec 28th, 2013 at 12:11 AM.
Reason: updated for anyone who stumbles in here in the future
-
Nov 10th, 2008, 08:01 AM
#3
Thread Starter
Junior Member
Re: Connecting to NTP Server (VB6 Winsock)
Thank you for the information. Doesn't there have to be some quick way of receiving the time information though? I found a program that will connect on demand to an NTP time server of my choice to update the system clock. Wouldn't this mean that a specific message must be sent somehow to the server to request the information back?
I know that the process to do this properly wouldn't be so simple, but I'm just looking for some sort of information back as a test. I've looked at all of these websites, but I haven't been able to find anything concrete as to actually how it is done, connectionwise.
-
Nov 10th, 2008, 10:50 AM
#4
Re: Connecting to NTP Server (VB6 Winsock)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|