Does anybody managed to establish HTTP with server at port 8080?

powerbroker
Posts: 31
Joined: Sun May 19, 2024 12:58 pm

Does anybody managed to establish HTTP with server at port 8080?

Postby powerbroker » Tue Feb 11, 2025 7:30 pm

hi,

even if it works with default HTTP port 80, i cannot use it whith server on 8080: http.POST(...) returns -1.
doing this way:

Code: Select all

if(WiFi.status()== WL_CONNECTED){

    HTTPClient http = HTTPClient("192.168.102.23", 8080);

    String httpRequestData = "serial=1&temp=29";

    int httpResponseCode = http.POST("/MR-Prototype/app/data/values/add", "application/x-www-form-urlencoded", httpRequestData);
    
    if (httpResponseCode > 0){
      Serial.print("HTTP Response code: ");
      Serial.println(httpResponseCode);
      Serial.println("Response payload:");
      Serial.println(http.getString());
    } else {
      Serial.print("Error code: ");
      Serial.println(httpResponseCode);
    }
    
    http.end();
}
if i missed something?

lbernstone
Posts: 916
Joined: Mon Jul 22, 2019 3:20 pm

Re: Does anybody managed to establish HTTP with server at port 8080?

Postby lbernstone » Wed Feb 12, 2025 7:35 pm

begin is a method which actively tries to connect to the destination port. It cannot be part of the object definition.

Code: Select all

    HTTPClient http;
    http.begin("192.168.102.23", 8080);

powerbroker
Posts: 31
Joined: Sun May 19, 2024 12:58 pm

Re: Does anybody managed to establish HTTP with server at port 8080?

Postby powerbroker » Thu Feb 13, 2025 5:48 pm

lbernstone wrote:
Wed Feb 12, 2025 7:35 pm
begin is a method which actively tries to connect to the destination port. It cannot be part of the object definition.

Code: Select all

    HTTPClient http;
    http.begin("192.168.102.23", 8080);
finally it compiles and goes on with:

Code: Select all

	http.begin("http://192.168.102.23:8080/app/data");

Who is online

Users browsing this forum: No registered users and 48 guests