We have been using the GC864 Quad V2 module successfully for FTP and HTTP, now we want to use UDP.
Can anybody point us to a complete UDP example using the GC864 or similar module?
Thanks Much
Hi Michael, UDP is not more complicated than TCP, take a look in Telit IP Easy User Guide for many hints. What would you like to accomplish with UDP comms?
Hi Michael, UDP is not more complicated than TCP, take a look in Telit IP Easy User Guide for many hints. What would you like to accomplish with UDP comms?
We would like to get the current time by sending a NTP (Network Time Protocol) packet
and receiving the time in a return UDP packet.
The simplest form will be to use Daytime protocol, receiving plain ASCII response, then SNTP which requires binary handling.
Hello Michael and Cosmin
This is an interesting question. Would be nice to find somewhere a Python script to completely handle the Daytime interrogation.
Thanks, Tom
Hello Michael and Cosmin
This is an interesting question. Would be nice to find somewhere a Python script to completely handle the Daytime interrogation.
Thanks, Tom
Tom,
We decided to get the time from our Amazon EC2 server by using HTTP to ask for a blank web page and parsing the returned header, see below.
We still want to learn to use the GC864 for UDP someday 🙂
Best,
Mike
AT+CREG?
>
>
>+CREG: 0,0
>
>OK
AT+CREG?
>AT+CREG?
>
>+CREG: 0,2
>
>OK
AT+CREG?
>AT+CREG?
>
>+CREG: 0,1
Connected
>AT#GPRS=0
>
>OK
OK found
GPRS=0..OK
>AT#GPRS=1
>
>ERROR
Re-trying GPRS
>AT#GPRS=0
>
>OK
OK found
GPRS=0..OK
>AT#GPRS=1
>
>+IP: 166.130.106.195
>
>OK
OK found
GPRS=1..OK
Sending http request for time
>AT#SKTD=0,80,”50.18.54.234″
>
>CONNECT
CONNECT found
Time Connected
>HTTP/1.1 200 OK
>Content-Type: text/html
>Last-Modified: Thu, 10 Nov 2011 00:21:52 GMT
>Accept-Ranges: bytes
>ETag: “d34a1cbf3e9fcc1:0”
>Server: Microsoft-IIS/7.0
>X-Powered-By: ASP.NET
>Date: Fri, 09 Dec 2011 00:51:40 GMT
Parsing
Day = 8
Month = 12 = Dec
Year = 2011
Time = 17 : 51 : 40 :
Unix Seconds = 1323366700
>Connection: close
>Content-Length: 39
>
></‰½‘åù
>NO CARRIER
Michael,
Thanks for your response. Would you mind me trying your server, just for testing purposes? If yes, please tell me what to send after "CONNECT" to trigger the sending of time information? Can you post the Python code that you use, please?
I think there are time servers for public use that could relaibly serve on a 24/7 basis. I have not yet investigated.
Best regards,
Tom
50.18.54.234 is one of the Amazon’s EC2 servers, check here.
But of course that is Amazon’s time, not a trusted one, as a dedicated server/service should be.
Here is how you will get the answer, ensure first network and GPRS is ready:
AT#GPRS=1
+IP: 10.88.249.23
OK AT#SKTD=0,80,"50.18.54.234"
CONNECT HTTP/1.1 200 OK Content-Length: 39 Content-Type: text/html Last-Modified: Thu, 10 Nov 2011 00:21:52 GMT Accept-Ranges: bytes ETag: "d34a1cbf3e9fcc1:0" Server: Microsoft-IIS/7.0 X-Powered-By: ASP.NET Date: Sat, 10 Dec 2011 09:21:25 GMT Connection: close
thanks for your prompt response! As I am not that fluent in Python yet, would really appreciate a ready made example for Daytime, if you have one at hand.
Tom
Just produced a small example, here is attached. The relevant part is:
print ‘Connecting on TCP …rn’ res = Chat(‘AT#SKTD=0,13,64.236.96.53r’, ‘*’, 30) print res
if (‘*’in res): Parse(res)
print ‘rnDisconnecting …rn’ MOD.sleep(20) res = Chat(‘+++’, ‘NO CARRIERrn’, 5) print res
print ‘Connecting on UDP …rn’ res = Chat(‘AT#SKTD=1,13,64.236.96.53r’, ‘CONNECTrn’, 30) print res
print ‘Sending dummy packet …rn’ res = Chat(‘1’, ‘*’, 10) print res
if (‘*’in res): Parse(res)
print ‘rnDisconnecting …rn’ MOD.sleep(20) res = Chat(‘+++’, ‘NO CARRIERrn’, 5) print res
The UDP method hasn’t many chances to work if you don’t have a public IP attached, but the TCP one is just fine.
Hi Cosmin
I tried your script and it works fine for me, without any modifications. Only one warning came: "+CME ERROR: context already activated".
Please see the attached file.
And as you warned, the UDP did not work, probably due to the fact that my GSM operator does not provide public addresses. Is there any workaround to this?
BR, Tom
Thanks Tom!
The activation message is normal if the context was already open (IP obtained) with a previous manual command or script run; one can test for context activation test and open only if is not open, but is a waste of one AT command, as the "context already activated" message does no harm. The test would only be useful if is needed to no the given IP.
Returning UDP with no public IP cannot work behind network operator’s routers/firewall because of the way these packets traverse them, being connectionless, and treated completely different from TCP packets for which traverse is tracked forth and back. So there is no way other than obtaining public IP from net operator (and talk to them about correct handling of returning UDP packets).
Thanks Cosmin, for your concluding words. Seems to be a bit unrealistic to use UDP then.
Tom
This script was VERY clear and helpful unlike a lot of the example scripts included in the Telit_Python_1_5_2+v4_1 package.
I am very interested in more examples.
If such examples exist, I would be most grateful if you could send me a link as I still do not have access to the download zone.
Maybe we can produce more based on requests here, from time to time. There is a separate package of Python examples, just sent you the link.
Thank you Cosmin!
Your quick responses have been most appreciated!
I resumethis oldpost to saythat you canuse the command "at#ntp", (see at-referencemanualrev15 on page468)fromfirmware version10.00.xx6.Ireplaced,in the cosmin’s script , the command "at#sktd…"with "at#ntp="ntp1.inrim.it",123,1,2" and itworks well.This commandalso automatically updates theclockmodule("at+cclk"etc.).
Fulvio, thank you! I must try this also…
Generally speaking, many new AT commands kind of "go wasted" as they are just buried in this all-too-lengthy AT command reference manual.
Telit people: More application note -kind of documents, with examples of how to use nice commands, please. And some short introductions of newly added commands as well.
BR, Tom
Hi, nice to see this old thread coming to life again 🙂 Also I would appreciate getting access to those Python examples that Cosmin refeerred to.
We use cookies to enhance your browsing experience and help us improve our websites. To improve our website, we carefully select third parties that use cookies to allow us to serve specific content and achieve the purposes set out in our cookie policy. For more information on how to make adjustments through your browser to the cookies being used on your device, please click Find Out More link. By closing this banner or continuing to browse our website, you agree to our use of such cookies. FIND OUT MORE
We have been using the GC864 Quad V2 module successfully for FTP and HTTP, now we want to use UDP.
Can anybody point us to a complete UDP example using the GC864 or similar module?
Thanks Much
Hi Michael, UDP is not more complicated than TCP, take a look in Telit IP Easy User Guide for many hints. What would you like to accomplish with UDP comms?
We would like to get the current time by sending a NTP (Network Time Protocol) packet
and receiving the time in a return UDP packet.
The simplest form will be to use Daytime protocol, receiving plain ASCII response, then SNTP which requires binary handling.
Hello Michael and Cosmin
This is an interesting question. Would be nice to find somewhere a Python script to completely handle the Daytime interrogation.
Thanks, Tom
Tom,
We decided to get the time from our Amazon EC2 server by using HTTP to ask for a blank web page and parsing the returned header, see below.
We still want to learn to use the GC864 for UDP someday 🙂
Best,
Mike
Michael,
Thanks for your response. Would you mind me trying your server, just for testing purposes? If yes, please tell me what to send after "CONNECT" to trigger the sending of time information? Can you post the Python code that you use, please?
I think there are time servers for public use that could relaibly serve on a 24/7 basis. I have not yet investigated.
Best regards,
Tom
50.18.54.234 is one of the Amazon’s EC2 servers, check here.
But of course that is Amazon’s time, not a trusted one, as a dedicated server/service should be.
Here is how you will get the answer, ensure first network and GPRS is ready:
The request after connect is simple:
Daytime protocol description is here, including a link to a list of working servers.
Do you need a Python example for daytime Tom?
Cosmin,
thanks for your prompt response! As I am not that fluent in Python yet, would really appreciate a ready made example for Daytime, if you have one at hand.
Tom
Just produced a small example, here is attached. The relevant part is:
The UDP method hasn’t many chances to work if you don’t have a public IP attached, but the TCP one is just fine.
Hi Cosmin
I tried your script and it works fine for me, without any modifications. Only one warning came: "+CME ERROR: context already activated".
Please see the attached file.
And as you warned, the UDP did not work, probably due to the fact that my GSM operator does not provide public addresses. Is there any workaround to this?
BR, Tom
Thanks Tom!
The activation message is normal if the context was already open (IP obtained) with a previous manual command or script run; one can test for context activation test and open only if is not open, but is a waste of one AT command, as the "context already activated" message does no harm. The test would only be useful if is needed to no the given IP.
Returning UDP with no public IP cannot work behind network operator’s routers/firewall because of the way these packets traverse them, being connectionless, and treated completely different from TCP packets for which traverse is tracked forth and back. So there is no way other than obtaining public IP from net operator (and talk to them about correct handling of returning UDP packets).
Thanks Cosmin, for your concluding words. Seems to be a bit unrealistic to use UDP then.
Tom
This script was VERY clear and helpful unlike a lot of the example scripts included in the Telit_Python_1_5_2+v4_1 package.
I am very interested in more examples.
If such examples exist, I would be most grateful if you could send me a link as I still do not have access to the download zone.
Maybe we can produce more based on requests here, from time to time. There is a separate package of Python examples, just sent you the link.
Thank you Cosmin!
Your quick responses have been most appreciated!
I resume this old post to say that you can use the command "at#ntp", (see at-reference manual rev 15 on page 468) from firmware version 10.00.xx6. I replaced, in the cosmin’s script , the command "at#sktd…" with "at#ntp="ntp1.inrim.it", 123,1,2" and it works well. This command also automatically updates the clock module ("at+cclk" etc.).
Fulvio, thank you! I must try this also…
Generally speaking, many new AT commands kind of "go wasted" as they are just buried in this all-too-lengthy AT command reference manual.
Telit people: More application note -kind of documents, with examples of how to use nice commands, please. And some short introductions of newly added commands as well.
BR, Tom
Hi, nice to see this old thread coming to life again 🙂 Also I would appreciate getting access to those Python examples that Cosmin refeerred to.
Best regards, Tom