11-26-2009 07:22 PM
I can get NIST time in Daytime format using the rt_nist_date_time.llb example posted on ni.com, but I cannot connect to NIST NTP format time data using port 123. I freely admit to being over my head with this stuff, and have spent much of this Thanksgiving holiday reading about UDP and TCP.
The attached vi summarizes what I've tried so far. The UDP case is what I thought would work, but I can't come up with a network address that the UDP-open vi likes. Can anyone out there help this n00b tell the time?
The attached file is supposed to be in 8.0 format, although I'm working in 9.0
Here is a link discussing the time formats: http://tf.nist.gov/service/its.htm
Jeff
Solved! Go to Solution.
11-26-2009 11:25 PM
Check the help for the UDP functions!
The network address for UDP open is optional, and only needed if your computer has multiple network interfaces configured. It has nothing to do with your remote server. UDP is a connectioness protocol.
You need four steps:
11-27-2009 12:08 AM - edited 11-27-2009 12:10 AM
OK, some digging on the web allowed me to get it working. See if you can parse the resulting string. 😉
(no guarantees.... ;))
11-27-2009 02:58 AM
altenbach wrote:See if you can parse the resulting string. 😉
OK, things seem to work. Here's how to parse the entire NTP packet. Of course if you only want the timestamp, you could just parse the desired substring and eliminate a lot of bulk.
Things are a bit tricky because the timestamp differs by 4 years from the LabVIEW definition and is in 32.32 FXP representation. If you don't care about fractional seconds, you could just parse the 32 bit integer part for even simpler code.
(I wrote this between turkey and dessert, so please make sure it's all correct. 😮 Modify as needed. :D)
11-27-2009 11:34 AM
THANK YOU!!! I don't think I ever would have come up with connecting the web address to a Read or Write UDP rather than the Open UDP block. Not to mention starting by opening port zero. FWIW, I did read the UDP help, as well as all the KB and forum information I could find, but it all added up to an incomplete understanding of how to arrange the blocks and what to feed them.
Your cluster approach to parsing is a lesson I'll keep at my fingertips - much simpler than my endless string of match-pattern filters!
Thanks again!
Jeff, (aka Roger the Shrubber )
11-27-2009 11:44 AM
11-27-2009 12:43 PM
jstevens wrote:THANK YOU!!! I don't think I ever would have come up with connecting the web address to a Read or Write UDP rather than the Open UDP block. Not to mention starting by opening port zero.
Unlike TCP, UDP is a connectionless protocol. Here's a quick explanation in different words.
Makes sense? 🙂
07-27-2010 03:55 PM
I tried the program but it failed on UDP read, any suggestion ?
07-27-2010 04:34 PM
@jimwu wrote:
I tried the program but it failed on UDP read, any suggestion ?
First suggestion: "failed" is not good enough to troubleshoot. Please provide the actual error code. I am guessing that it timed out, meaning that no response came back. This could have many reasons.
07-27-2010 04:44 PM
Also make sure to enter the IP address correctly. In the original program, the string entry box was not limited to a single line, making entry errors more likely. Here's a new version where the IP address is limited to a single line.