-->
Page 1 of 2

Get client request to local network directly disconnects

PostPosted: Thu Apr 30, 2015 12:53 pm
by Nicky Jaspers
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?

Re: Get client request to local network directly disconnects

PostPosted: Thu Apr 30, 2015 10:08 pm
by TerryE
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.

Re: Get client request to local network directly disconnects

PostPosted: Fri May 01, 2015 1:44 am
by Nicky Jaspers
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.

Re: Get client request to local network directly disconnects

PostPosted: Fri May 01, 2015 10:52 am
by TerryE
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.