Left here for archival purposes.

User avatar
By Nicky Jaspers
#16105 firware version: 20150331
When running following code:

Code: Select alltmr.alarm(0,10000,1,function()
conn=net.createConnection(net.TCP, false)
conn:on("receive", function(conn, pl) print(pl) end)
conn:on("disconnection", function(conn) print("disconnected") end)
conn:connect(80,"121.41.33.127")
conn:send("GET / HTTP/1.1\r\nHost: www.nodemcu.com/\r\n"
.."Connection: keep-alive\r\nAccept: /\r\n\r\n")
end)

no issue: stable

when changing the following lines

Code: Select allconn:connect(8084,"192.168.178.42")
conn:send("GET /json.htm?type=command&param=udevice&idx=6&nvalue=0&svalue=20.5 HTTP/1.1\r\nHost: nas:8084/\r\n"
    .."Connection: keep-alive\r\nAccept: */*\r\n\r\n")


directly a disconnect, while this request from other devices in my local network can access this url.

Is it a bug, or am I doing something wrong?
User avatar
By TerryE
#16149 Have you tried instrumenting your listener on 192.168.178.42:8084. The most likely reason is that your listener is closing the connection without replying after examining the request.
User avatar
By Nicky Jaspers
#16157
TerryE wrote:Have you tried instrumenting your listener on 192.168.178.42:8084. The most likely reason is that your listener is closing the connection without replying after examining the request.


Code: Select allconn:send("GET /json.htm?type=command&param=udevice&idx=6&nvalue=0&svalue=20.5 HTTP/1.1\r\nHost: 192.168.178.42:8084/\r\n"
    .."Connection: keep-alive\r\nAccept: */*\r\n\r\n")


you mean this? Yes I tried this, but also didn't work.
The same request layout, headers etc.. when I do this in a browser on a different system in my local network works like a charm. And a reply is sent.
User avatar
By TerryE
#16196 No I mean look at your Apache (or whatever) logs as well as any firewall that you may have on your host. Just because the connection is being closed doesn't mean that the ESP code isn't making the attempt.