【发布时间】:2019-12-17 02:51:44
【问题描述】:
我正在尝试通过以下代码将我的 NodeMCU V3(基于 ESP8266)连接到 http://ya.ru:
station_cfg={}
station_cfg.ssid="ssid" -- actual ssid was here
station_cfg.pwd="password" -- and password
server_link = "http://ya.ru"
wifi.setmode(wifi.STATION)
wifi.sta.config(station_cfg)
wifi.sta.connect()
http.put(server_link,
'hi',
function(code, data)
print(code)
if (code < 0) then
print("HTTP request failed")
else
print(code, data)
end
end)
但是连接不成功,输出为:
HTTP client: Response too long (8461)
有什么问题吗? SSID 和密码正确。所有GET、POST、PUT 方法都存在同样的问题。
更新: 嗯,使用 Arduino IDE 中的 C 语言编写的相同脚本一切正常。无论如何,我很奇怪 Lua 解释器不能做这样的请求,但从 C 编译的版本可以。
【问题讨论】: