Page 1 of 1
HTTP using Ethernet
Posted: Mon May 15, 2017 8:06 am
by dvrp13
Hi everyone
I am trying to send data to a MySQL database using Ethernet on the ESP32 with HTTP Post Requests.
I was able to get an IP address using the Ethernet example but I don't know how to do the HTTP POST using Ethernet.
Re: HTTP using Ethernet
Posted: Mon May 15, 2017 11:48 am
by rudi ;-)
dvrp13 wrote:Hi everyone
I am trying to send data to a MySQL database using Ethernet on the ESP32 with HTTP Post Requests.
I was able to get an IP address using the Ethernet example but I don't know how to do the HTTP POST using Ethernet.
perhabs this helps
you can simple use each example ( TCP, FTP, SMP, ... and so on )
same way.
best wishes
rudi
Re: HTTP using Ethernet
Posted: Tue May 16, 2017 9:16 am
by dvrp13
Thanks!
I was able to do a http get request using parts of the http request example.
But sometimes it is stuck in the do...while just before the putchar used to print the html code.
It prints DO 1 and DO 2 but then it is stuck.
Code: Select all
do {
ESP_LOGI(TAG, "DO 1");
bzero(recv_buf, sizeof(recv_buf));
ESP_LOGI(TAG, "DO 2");
r = read(s, recv_buf, sizeof(recv_buf)-1);
ESP_LOGI(TAG, "DO 3");
for(int i = 0; i < r; i++) {
putchar(recv_buf[i]);
}
ESP_LOGI(TAG, "DO 4");
} while(r > 0);
Re: HTTP using Ethernet
Posted: Wed May 17, 2017 12:08 am
by kolban
From that code fragment, you a blocking in the sockets read() call. This is a blocking call that won't return until some data has been received over the socket.
Re: HTTP using Ethernet
Posted: Sat May 20, 2017 4:33 pm
by dvrp13
Sorry for my late answer.
It looks like the network of my university college is blocking the network traffic from the ESP32.
On that network it is detected as http proxy but all proxy network is blocked.
Would it be possible to bypass this? Maybe by changing the user agent?