2018-01-24 05:43 AM
Hi,
I'm working on SPWF04 linked by UART with a NUCLEO F411RE board; I'm facing with a strange problem: I'm trying to connect with an NTP server to synchronize the NUCLEO RTC, so after create a wifi connection, I open the socket, send the data, but the server not answer even if the request going well. This is what I send and what I receive:
TX: AT+S.SOCKON=193.204.114.105,123,,u
RX: AT-S.On:193.204.114.105:0
RX: AT-S.OK
TX: AT+S.SOCKW=0,48<CR><ESC><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL>
RX: AT-S.OK
but after if I try to check any answer, I read:
TX: AT+S.SOCKQ=0
RX: AT-S.Query:0
RX: AT-S.OK
Please, could anyone tell me what's wrong ? Where's the problem ?
Regards
Davide Urbano
#spwf04 #ntp2018-01-24 09:49 AM
Simple Berkeley Sockets implementation where you open a socket and listen. In Windows with libraries like WINSOCK. When developing TCP based server/client applications it helps to be able to emulate and test what you're doing, and sanity check things.
Also pool.ntp.org or time.windows.com
2018-01-24 10:34 AM
d.urbano said that NTP server is working (another PC was used for the purpose of NTP Client). Also the routing was verified from the board using ping test.
So we need to see real NTP request from the board to prove it is correctly configured as the NTP client.
2018-01-24 11:04 AM
My point more generally is that when debugging protocols and interactions it is often helpful to be able to debug and diagnose locally rather that via a large black box where you have no control or visibility into.
Given the level of abuse NTP servers see they might also blacklist specific clients, or limit DoS attacks (errant client banging on server repetitively)
2018-01-24 11:11 AM
Yes, agree. But writing socket server is not so simple if you not experience in C programming. But frankly node.js or other scripting languages make thing easier.
2018-01-24 11:11 AM
Of course you can always start local ntp service using linux...
2018-01-25 03:46 AM
After many attempts, no one data there is on WireShark...
2018-01-25 05:01 AM
If you could check if use see ICMP packets during the ping tests.
This way we can verify that Wireshark is setup correctly i.e. it sniffs right interfaces and the traffic can be captured.
We want to avoid situation when the Wireshark cannot capture the traffic and conclude that the NTP packest are NOT sent.
Why the Wireshark can miss the traffic:
-when you use switches in the network the link between switch port is somewhat virtual - the other not involved porta cannot see the traffic. You need to have mirror-port functionality i.e. you need to configure traffci replication to the port where the sniffer is connected to.
So it is interesting where the Wireshark is ran and how the traffic you want to sniff is delivered to the Wireshark interface (host port) you ar elitening on.
2018-01-25 06:02 AM
Yes I can see the ICMP packets; and I can get a web page with command AT+S.HTTPGET. One question: is correct the request I send to NTP server ?
AT+S.SOCKW=0,48<CR><ESC><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL><NUL>
Is there any error in this command ?
2018-01-25 08:18 AM
NTP uses UDP so HTTPGET is not for this purpose because it is TCP based request.
2018-01-25 08:22 AM
I am not familiar with this module - have you implemented own UDP Client?
NTP is not about requesting time using UDP/123 - it's quite complex protocol which takes into account network delays, etc.