Page 1 of 1

Issue sending data to browser using AT commands and TCP server

Posted: Wed Aug 15, 2018 1:40 pm
by Quagmire
I am attempting to create a TCP server on the ESP32 in order to connect to a browser page, which will allow users to enter their local WiFi SSID and password, along with some other program specific information.

I have followed the example commands in the ESP32 AT Instruction Set pdf...specifically, those on pages 73-75 for setting up a TCP server.

The issue that I have is that once a request has been made from the browser (Chrome Version 68.0.3440.106, 64 bit, running on Windows 7) to IP address 192.168.4.1, the ESP32 reports a connection, but then I cannot send information back to the browser...none of the AT+CIPSEND commands will allow it...they all report "ERROR"...I tried every version of them for both links 0 and 1. Eventually, the connection times out and is closed automatically.

Below is the command set that I entered via a terminal emulator. If anyone can give me suggestions or advise me as to where the issue is, I would appreciate it!!

AT+RESTORE
1,CLOSED
0,CLOSED

OK

ready
AT+GMR
AT version:1.2.0.0-dev(c3c7f6f - Jun 20 2018 07:40:00)
SDK version:v3.1-dev-1381-g9a55b42f
compile time:Jun 26 2018 14:02:43

OK
AT+CWSAP="MyESP32SSID","MyPassword",5,3,5,0

OK
AT+CWMODE=3

OK
AT+CIPMUX=1

OK
AT+CIPSERVER=1,80

OK
AT+CIPSTO=1000

OK
AT+CIPDINFO=1

OK

+IPD,0,405,192.168.4.2,49519:GET / HTTP/1.1
Host: 192.168.4.1
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9

0,CONNECT
1,CONNECT
AT+CWLIF
+CWLIF:192.168.4.2,xx:xx:xx:xx:xx:xx //Note: I replaced the MAC address with x's

OK
AT+CIPSTATUS
STATUS:3
+CIPSTATUS:0,"TCP","192.168.4.2",49519,80,1
+CIPSTATUS:1,"TCP","192.168.4.2",49520,80,1

OK
AT+CIFSR
+CIFSR:APIP,"192.168.4.1"
+CIFSR:APMAC,"xx:xx:xx:xx:xx:xx" //Note: I replaced the MAC address with x's
+CIFSR:STAIP,"0.0.0.0"
+CIFSR:STAMAC,"xx:xx:xx:xx:xx:xx" //Note: I replaced the MAC address with x's

OK
AT+CIPSEND=0,4

ERROR
AT+CIPSENDEX=0,4

ERROR
AT+CIPSEND=4

ERROR
AT+CIPSENDEX=4

ERROR
AT+CIPSEND=1,4,"192.168.4.2",49520

ERROR
AT+CIPSENDEX=1,4,"192.168.4.2",49520

ERROR
AT+CIPSEND=0,4,"192.168.4.2",49519

ERROR
AT+CIPSENDEX=0,4,"192.168.4.2",49519

ERROR
AT+CIPSEND=1,4

ERROR
AT+CIPSENDEX=1,4

ERROR
1,CLOSED

Re: Issue sending data to browser using AT commands and TCP server

Posted: Sun Sep 16, 2018 4:51 am
by danmcc22
I'm new this myself but a do see a problem in your CIFSR response being "+CIFSR:STAIP,"0.0.0.0". You don't have an IP address.
Try AT+CWJAP=.... instead of AT+CWSAP=.... CWSAP configures YOUR softAP. Hope this helps.