Chat freely about anything...

User avatar
By vcch
#45498 I was unable to GET a web page using wemos d1 and my usual script (which works with nodemcu, with the same firmware I flashed on the D1).

Finally i found how to make it work, but I'm not sure why :

==== Version working on nodemcu but not on Wemos D1 (i had a timeout)
sk=net.createConnection(net.TCP, 0)
sk:on("receive", function(sck, c) print(c) end )
sk:on("connection", function(sck)
sck:send("GET /mypage HTTP/1.1\r\nHost: myserver.ovh.net\r\n)
sck:send("Connection: keep-alive\r\nAccept: */*\r\n\r\n")
end)
sk:connect(80,"myserver.ovh.net")

== Version workinng on both
sk=net.createConnection(net.TCP, 0)
sk:on("receive", function(sck, c) print(c) end )
sk:on("connection", function(sck)
sck:send("GET /mypage HTTP/1.1\r\nHost: myserver.ovh.net\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n")
end)
sk:connect(80,"myserver.ovh.net")