Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Has anyone used the Daytime protocol on an esp8266?

 
Post new topic   Reply to topic    Forum Index -> ZBasic for Generic Targets
Author Message
JimG



Joined: 24 Mar 2017
Posts: 17

Posted: 24 March 2017, 23:28 PM    Post subject: Has anyone used the Daytime protocol on an esp8266? Reply with quote

For my first ZBasic project, I wanted to get the date/time from the Daytime Protocol server from Nist. (RFC-867). It works using tcp/ip or udp/ip on port 13. So I thought I'd just change the server to "time.nist.gov" and the port to 13 in the ClientTCP.bas program in the Examples-ESP8266 folder. Everything seemed to be going well except no message was ever received.
Has anyone used the protocol successfully, and if so, could you share some code, or at least give some hints at what needs to be changed?
Back to top
JimG



Joined: 24 Mar 2017
Posts: 17

Posted: 26 March 2017, 23:09 PM    Post subject: Reply with quote

After many hours of testing, it mysteriously started working. Went back to the original code, and it also worked. No idea what the problem was. It only works on tcp however. It should work on udp also, but just doesn't.
Back to top
JimG



Joined: 24 Mar 2017
Posts: 17

Posted: 22 April 2017, 1:04 AM    Post subject: Daytime Protocol Reply with quote

After several weeks of struggle, I'm still having problems getting this protocol to work consistently.

I've gotten it to work pretty good, but I would like a better success rate for attempts. I wrote the below program to help figure out the best way to code this, and these are typical results-

Code:
------- stats -------   runtime=7562.40 seconds  3:06:02.40
 total successful attempts = 200 of 438 = 45%
 1  216.228.192.69   25 good of 25  trys, connect timeouts=0   read timeouts=0   disconnects=0 
 2  129.6.15.30      14 good of 16  trys, connect timeouts=1   read timeouts=1   disconnects=0 
 3  64.113.32.5      29 good of 30  trys, connect timeouts=0   read timeouts=0   disconnects=1 
 4  216.229.0.179    19 good of 236 trys, connect timeouts=105 read timeouts=0   disconnects=112
 5  129.6.15.28       3 good of 11  trys, connect timeouts=6   read timeouts=2   disconnects=0 
 6  128.138.141.172  90 good of 94  trys, connect timeouts=0   read timeouts=0   disconnects=4 
 7  129.6.15.29       4 good of 7   trys, connect timeouts=2   read timeouts=1   disconnects=0 
 8  129.6.15.27      16 good of 19  trys, connect timeouts=2   read timeouts=1   disconnects=0 
  Maximum connect time=1.71        Maximum wait data time=9.16
  Average connect time=0.1222166  Average wait data time=0.5689964


The ip addresses you see are the one given out by nist by accessing time.nist.gov, and they are supposedly given out in a manner to balance the load on the servers.

The real problem site seems to be 216.229.0.179, which you can see only succeeded 19 out of 236 tries. A pretty miserable success rate. Also, it is by far the most commonly served host by nist. After thinking about this a lot, I've come to the conclusion that this is probably their fastest, and therefore least busy server.

The majority of failures seem to be that we timed out before connection was made (I had to add a Net.SetTimeout command because if we don't get connected in 10 seconds, we never will and the program just dies) or we got a disconnect before we got the data. But looking at the timing when it works, it is very fast. Therefore, I think the problem is that we are too slow and missing the response from the server. Either the esp's aren't fast enough (I've tried 8 different esp's, both 1 and 4 meg units with similar results), or there is something going on that is bogging down the net.connect command to the point where it misses the connect and/or data sent.

If you get a chance, would you take a quick look to see if there is something odd on the ZBasic side? I've tried everything I can think of at my level.

I really appreciate the effort you put into making this available. I really can't stand curly braces.



daytime.zip
 Description:

Download
 Filename:  daytime.zip
 Filesize:  6.14 KB
 Downloaded:  41 Time(s)

Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2991
Location: Portland, OR

Posted: 24 April 2017, 16:06 PM    Post subject: Re: Daytime Protocol Reply with quote

JimG wrote:
If you get a chance, would you take a quick look to see if there is something odd on the ZBasic side?
I have a critical project underway but I should be able to take a look at this and the MAC address issue in the next few days.
Back to top
JimG



Joined: 24 Mar 2017
Posts: 17

Posted: 24 April 2017, 19:18 PM    Post subject: Reply with quote

Thank you very much. I understand that real life comes first, and am very appreciative of the efforts you have put into making ZBasic work with the esp.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic for Generic Targets Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2017 Elba Corp. All rights reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group