This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Scrit HTTP request timeout
#1
Hi,

Got a LM5 i.MX6 with most recent fw (20210510) and I?m experiencing a wired issue

IP configuration is correct.. I can ping 8.8.8.8 and traceroute www.google.com correctly, but.. all lua script that uses socket.http library goes in timeout error.
luasocket library is version 2.0.2-20210217

This of course will prevent any script to run as they are intended.

Is is an issue someone else has faced and fixed?
thanks
Regards

P.S.

this is the script:

Code:
require('json')
local http = require('socket.http')
http.TIMEOUT = 30

local OWMLINK    = 'https://api.openweathermap.org/data/2.5/onecall?'
local OWMAPIKEY  = ''
local OWMUNIT    = 'metric'
local OWMLAT     =
local OWMLON     =
local OWMLANG    = 'it'
local OWMEXCLUDE = 'minutely,hourly'
OWMLINK = OWMLINK..'lat='..OWMLAT..'&lon='..OWMLON..'&appid='..OWMAPIKEY..'&units='..OWMUNIT..'&exclude='..OWMEXCLUDE
log(OWMLINK)
local OWMResponse, code, headers, status= http.request(OWMLINK)
log(code, status, headers)
if not OWMResponse then
  alert('Previsioni OpenWeather: Impossibile recuperare dati')
  return
end

local data = json.pdecode(OWMResponse)
if not data then
  alert('Previsioni OpenWeather: Impossibile convertire dati')
  return
end

variable "code" result timeut
...it is not a timeout parameter issue Wink
this is an example.. I do have the telegram notification script that doesn't work either
Reply
#2
Try Like this,
Code:
require('json')
local http = require('socket.http')


local OWMLINK    = 'https://api.openweathermap.org/data/2.5/onecall?'
local OWMAPIKEY  = ''
local OWMUNIT    = 'metric'
local OWMLAT     = '41.8719'
local OWMLON     = '12.5674'
local OWMLANG    = 'it'
local OWMEXCLUDE = 'minutely,hourly'

local OWMResponse, err= http.request( OWMLINK..'lat='..OWMLAT..'&lon='..OWMLON..'&lang='..OWMLANG..'&exclude='..OWMEXCLUDE..'&appid='..OWMAPIKEY..'&units='..OWMUNIT)

log(OWMResponse, err)

if OWMResponse then
 
  local data = json.pdecode(OWMResponse)
   log(data)
 
 
  else if err then
  log('ERROR :' .. err)
  end
end
Reply
#3
thnaks...
I found the issue.... I made a BAD mistake on the NAT setup on my router....

it is now working good
thanks
ciao
M
Reply


Forum Jump: