Chat freely about anything...

User avatar
By rant
#30757 Hi.

Of course i am first connecting to the net, then connecting to port 80 with TCP.
The library i use is WEESP8266 , and the code above is exactly like his documentations .
(this library is using AT commands).

Do you have other good library to suggest that is only based on native AT commands? (we dont want to use nodemcu anymore for production reasons) .



This is the code before what you saw : ( I do get good respond when connecting to the TCP port of the server )


Code: Select all if (wifi.setOprToStation())
          {
              Serial.print("to station ok\r\n");
          }
          else
          {
              Serial.print("to station err\r\n");
          }


         
          if (wifi.joinAP(SSID, PASSWORD)) {
              Serial.print("Join AP success\r\n");
              Serial.print("IP: ");       
              Serial.println(wifi.getLocalIP().c_str());
          }
          else
          {
              Serial.print("Join AP failure\r\n");
          }
         

   if (wifi.enableMUX())
   {
        Serial.print("multiple ok\r\n");
    } else
    {
        Serial.print("multiple err\r\n");
    }

  uint8_t buffer[128] = {0};

   static uint8_t mux_id = 0;
   
    if (wifi.createTCP(mux_id, HOST_NAME, HOST_PORT)) {
        Serial.print("create tcp ");
        Serial.print(mux_id);
        Serial.println(" ok");
    } else {
        Serial.print("create tcp ");
        Serial.print(mux_id);
        Serial.println(" err");
    }
User avatar
By EspFan
#30761 Try this instead:
char *hello = "GET /index.php HTTP/1.1\r\nHost:ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com\r\nUser-Agent:runscope/0.1\r\nContent-Type:application/json\r\nConnection:close\r\n\r\n";

I removed the gzip encoding type (you would need to incorporate unzip code to understand the response), and specified that the connection will be closed.
And finally I added an additional trailing linebreak to indicate to the webserver that there is no body. This is not strictly necessary, but is helpful.
User avatar
By rant
#30764 Thanks, didn't work. Well, i do manage to connect to the tcp on port 80 . I just cant get this request to work.