As the title says... Chat on...

User avatar
By seedseifer
#56370 Hello all,

So, I have the lastest nodemcu master firmware with http module.

My code has a 15sec timer just for http get on my site that returns detetime stamp.

The logical is simple, if success store the time stamp in a variable, if network fail ,set fail in var and in every next attempt to do "get" include an flag, my server stores this fail.

The problem is return code "-1" that I dont know what means and appears that request is sent to my server anyway. :roll:

I Don't know if http stores the request in a buffer or something like that....so, anybody can help me?


Code: Select allhttp.get("http://httpbin.org/exemple.php" .. set_error, nil, function(code, data)
    if (code < 0) then
      print("HTTP request failed")
set_error =  "?id=error"
    else
      print(code, data)
set_error =  ""
    end
  end)
User avatar
By seedseifer
#56751
marcelstoer wrote:http://httpbin.org/exemple.php returns HTTP 404 because the resource does not exist. Try http://httpbin.org/get for example.

This is not the case, for all http return codes (including 200, 403, 500 etc) is greater than the code -1, I dont know what -1 code means (network error? Dns error?).

But even with -1 return code some times a see the get request stored in DB.

Any clue?