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?
Has anyone used the Daytime protocol on an esp8266?
Daytime Protocol
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-
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.
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: Select all
------- 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 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.
- Attachments
-
- daytime.zip
- (6.14 KiB) Downloaded 361 times
Re: Daytime Protocol
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.JimG wrote:If you get a chance, would you take a quick look to see if there is something odd on the ZBasic side?
- Don Kinzer