{"action":"closed","issue":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1447","repository_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware","labels_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1447/labels{/name}","comments_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1447/comments","events_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1447/events","html_url":"https://github.com/nodemcu/nodemcu-firmware/issues/1447","id":170449779,"number":1447,"title":"conn:send() behaviour with recent “NodeMCU custom builds” FW","user":{"login":"arset","id":16742578,"avatar_url":"https://avatars.githubusercontent.com/u/16742578?v=3","gravatar_id":"","url":"https://api.github.com/users/arset","html_url":"https://github.com/arset","followers_url":"https://api.github.com/users/arset/followers","following_url":"https://api.github.com/users/arset/following{/other_user}","gists_url":"https://api.github.com/users/arset/gists{/gist_id}","starred_url":"https://api.github.com/users/arset/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arset/subscriptions","organizations_url":"https://api.github.com/users/arset/orgs","repos_url":"https://api.github.com/users/arset/repos","events_url":"https://api.github.com/users/arset/events{/privacy}","received_events_url":"https://api.github.com/users/arset/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-10T15:42:02Z","updated_at":"2016-08-10T18:56:03Z","closed_at":"2016-08-10T18:56:02Z","body":"\r\n8<------------------------ BUG REPORT -----------------------------------------\r\n### Expected behavior\r\nThe code of the example “A simple http client” present on http://nodemcu.com/index_en.html \r\nshould establish a connection with www.nodemcu.com and retrieve a small test web page.\r\n\r\n### Actual behavior\r\n\r\nThe code of the example that used to work correctly with old FW (e.g.  nodemcu_integer_0.9.6-dev_20150704.bin)  run on ESP board flashed with new FW generated using “NodeMCU custom builds” doesn't return the expected web page. \r\n\r\nI got similar results replacing www.nodemcu.com 121.41.33.127 with the address of my website.\r\nThe code run on ESP board flashed with OLD FW works but the same code run on ESP board flashed with new FW doesn't unless I introduce a delay between the conn:connect() and the conn:send()\r\n\r\n### Test code\r\n\r\n-- A simple http client\r\nconn=net.createConnection(net.TCP, false) \r\nconn:on(\"receive\", function(conn, pl) print(pl) end)\r\nconn:connect(80,\"121.41.33.127\")\r\nconn:send(\"GET / HTTP/1.1\\r\\nHost: www.nodemcu.com\\r\\n\"\r\n    ..\"Connection: keep-alive\\r\\nAccept: */*\\r\\n\\r\\n\")\r\n### NodeMCU version\r\nWhich branch are you on? If you know the Git revision then add it here as well.\r\n\r\n### Hardware\r\nI've repeater the test using two different ESP-12 and a ESP-1 with the same results.\r\n\r\n### Remarks\r\n\r\nThe code of the example “A simple http client” present on http://nodemcu.com/index_en.html that used to work correctly with old FW (e.g.  nodemcu_integer_0.9.6-dev_20150704.bin)  apparently doesn't work anymore with new FW generated using “NodeMCU custom builds”.\r\n\r\nI saved the code of the example:\r\n\r\n-- A simple http client\r\nconn=net.createConnection(net.TCP, false) \r\nconn:on(\"receive\", function(conn, pl) print(pl) end)\r\nconn:connect(80,\"121.41.33.127\")\r\nconn:send(\"GET / HTTP/1.1\\r\\nHost: www.nodemcu.com\\r\\n\"\r\n    ..\"Connection: keep-alive\\r\\nAccept: */*\\r\\n\\r\\n\")\r\n\r\nin a file; then I used “ESP8266 LuaLoader 0.91” to upload the file (“simple.lua”) on two of my ESP board that I have previously flashed using different FW: \r\n- nodemcu_integer_0.9.6-dev_20150704.bin (gotten from Git-Hub),\r\n- nodemcu-master-7-modules-2016-04-09-17-13-19-integer.bin (generated last week using “NodeMCU custom builds” service).\r\n\r\nRunning dofile(“simple.lua”) by selecting “simple.lua” and pressing “dofile” button in “ESP8266 LuaLoader 0.91” terminal I got very different results depending from the flashed FW.\r\n\r\nIf I run the command on an ESP8266 flashed with the old FW ( nodemcu_integer_0.9.6-dev_20150704.bin), the ESP chip correctly connect to NodeMCU website, which return the expected html page;\r\n\r\nbut the same sequence executed on the ESP8266 flashed with the new FW (for instance nodemcu-master-7-modules-2016-04-09-17-13-19-integer.bin) produce NO result.\r\n\r\nRepeating the test replacing  121.41.33.127  www.nodemcu.com with the address of a webserver under my control I have verified that “A simple http client” running under the new FW hang up immediately after establishing a “client connection”; that is the TCP/IP handshaking pass the accept() but the recv() never receive any data.\r\n\r\nDoing some testing I have discovered that the problem seem in relation with the timing of the conn:send() because if I type “A simple http client” one row at a time sometime the code works.\r\n\r\nThe code also works with my website if I modify the code as follows:\r\n\r\n-- A simple http client\r\nconn=net.createConnection(net.TCP, false) \r\nconn:on(\"receive\", function(conn, pl) print(pl) end)\r\nconn:connect(80,\"121.41.33.127\")\r\n\r\nsz0 = \"GET / HTTP/1.1\\r\\nHost: www.nodemcu.com\\r\\n\"\r\nsz1 = \"Connection: keep-alive\\r\\nAccept: */*\\r\\n\\r\\n\"\r\n\r\ntmr.alarm(0, 1000, 0, function()conn:send(sz0, sz1) end)\r\n\r\nIf you have any suggestion to fix the problem let me know, you are welcome.\r\n\r\nBest regards\r\n\r\n8<------------------------ END BUG REPORT -------------------------------------\r\n\r\n\r\n"}}
{"actor":{"display_login":"marcelstoer"}}