HTTP (s) TCP File Download For OTA

PC based Python script example to download a file from a HTTP Server and send to a host processor.

This example can be used to update your product over the air (OTA) or just to download a file off a HTTP or HTTPs server.

    • Down load HFS free HTTP server and Start Server
    • Setup a client to connect to module to send the following:
      ssid, password, security type, server DNS name or IP address, server port
    • Edit URL in script to point to where you loaded file to be download
      //parsed = urlparse.urlparse(“http(s)://domain:Port/path/filename)
      //parsed = urlparse.urlparse(“http://10.16.190.166:1443/filename.bin”)
    • Edit location in script to change location for the file to be saved.
      fname = “C:\\Users\\mypc\\test_download.bin”
    • Run the script

Recommended tools:

  1. HFS File server Download here
  2. IWIN  AT Command  Example- TCP -UDP File Download Script Python
  3. eS-WiFi PC drivers ( easily installed using our PC demo application (ZIP)

    New Features:

#——————————————————————————-
# Name: File Download to Host Interface Demo
# Purpose: To illustrate how to use the TCP/UDP cLient IWIN AT commands to
# download a file from a HTTP server and send the data to the host
# processor.
# Key Parameters to set:
baud = 115200
Protocol Setup
PROTOCOL=”0″ #TCP=0, UDP=1, UDP-Lite=2 TCP-SSL=3(Hercules doesn’t support)

#Local Network Setup
SSID = “xxxxxxxxxx” #SSID of AP
PSWD = “ThisIsMyWorkNetwork” #Password of AP
SEC=”4″ #Security type of AP: 0-Open, 1-WEP, 2-WPA, 3-WPA2-AES, 4-WPA2-Mixed
DHCP=”1″ #Get IP address for DHCP, 0-No, 1-Yes

#Client Mode
remoteIP = “192.168.10.100” #Remote Server IP address (use 192.168.10.100 with AD Direct Mode)
remotePort = “8002” #Remote TCP port

#Server Mode
clientIP = “192.168.10” #Client IP address, use to validate sever accept
localPort = “8003” #Local server port

#Parse URL
#parsed = urlparse.urlparse(“http://192.168.1.3:1443/ISM43362_M3G_L44_Cxxx.bin”)
parsed = urlparse.urlparse(“http://10.16.190.166:1443/ISM43362_M3G_L44_Cxxx.bin”)

 

 

2015-06-25T20:59:24+00:00 2019-03-01T19:33:45+00:00