Thanks a lot for your help
2. If step 1 confirms data is being sent alright, then you can check espconn status in this sent_callback function, instead of where you are checking now. This way, if sent_cb is not executed or has error - you know that the link was faulty and the GET request failed.
As I said i am sending two requests, the first one runs successfully and i also get a tcp_sent callback (which looks like this):
Code: Select all
LOCAL void ICACHE_FLASH_ATTR
user_tcp_sent_cb(void *arg)
{
struct espconn *pespconn = (struct espconn *)arg;
os_printf("tcp sent succeed, STATE IS: %d !!! \r\n",(int)pespconn->state);
}
The state of the connection is '3' (so ESPCONN_LISTEN i guess), this means for me that the connection is still established and not disconnected? Therefore i think that it shouldn't be a problem to send another request with the same connection, should it?
I use the exact same request structure in my second request, for example, this is my first request:
Code: Select all
os_sprintf(requestText, "GET /SQL.php?request=getReq / HTTP/1.1\r\nUser-Agent: curl/7.37.0\r\nHost: %s\r\nAccept: */*\r\n\r\n",NET_DOMAIN);
where
NET_DOMAIN is my website.
That's my second request:
Code: Select all
os_sprintf(requestText, "GET /SQL.php?request=enterTemp&reqid=%s&value=%d / HTTP/1.1\r\nUser-Agent: curl/7.37.0\r\nHost: %s\r\nAccept: */*\r\n\r\n",reqID,tempValue,NET_DOMAIN);
Why would the first one work but the second one not? I print the request to serial terminal and it looks like this:
GET /SQL.php?request=enterTemp&reqid=5&value=34 / HTTP/1.1
User-Agent: curl/7.37.0
Host:
http://www.mywebsite.orgAccept: */*
you know that the link was faulty and the GET request failed.
Because of that i don't think that my request is wrong but it failed for sure. I also sent the originally second request as first one and it worked fine!
3. If above is all good but the server still does not respond, you should make sure the server understands the GET command using telnet.
Unfortunately my webspace provider doesn't offer a telnet connection (i am using a hoster who offers free webspaces).