As the title says... Chat on...

User avatar
By picstart
#6578 OK
The earlier code allowed for multiple calls to send the new code doesn't.
The work around was to either put all the lines to be send into a single string and send it or just send a file .
Now packets have a max size of 1460 bytes and the suspicion is it is an issue with the new unpleasant feature of a single send.
Code: Select allhttpserver = function ()

srv=net.createServer(net.TCP)
srv:listen(80,
      function(conn)
      conn:on("receive", function(conn, payload) print(payload) end)
     file.open("calculatorxx.rtl")
      conn:send(file.read())
     file.close()
     conn:on("sent",function(conn) conn:close() end)
      end --conn
    )

end

<html>
<head>
<title>Html calculator</title>
</head>
<body>
<form name="calculator" >
Solution<input type="textfield" name="ans" value="">
<br>
<input type="button" value="1" onClick="document.calculator.ans.value+='1'">
<input type="button" value="2" onClick="document.calculator.ans.value+='2'">
<input type="button" value="3" onClick="document.calculator.ans.value+='3'">
<input type="button" value="+" onClick="document.calculator.ans.value+='+'">
<br>
<input type="button" value="4" onClick="document.calculator.ans.value+='4'">
<input type="button" value="5" onClick="document.calculator.ans.value+='5'">
<input type="button" value="6" onClick="document.calculator.ans.value+='6'">
<input type="button" value="-" onClick="document.calculator.ans.value+='-'">
<br>
<input type="button" value="7" onClick="document.calculator.ans.value+='7'">
<input type="button" value="8" onClick="document.calculator.ans.value+='8'">
<input type="button" value="9" onClick="document.calculator.ans.value+='9'">
<input type="button" value="*" onClick="document.calculator.ans.value+='*'">
<input type="button" value="/" onClick="document.calculator.ans.value+='/'">
<br>
<input type="button" value="0" onClick="document.calculator.ans.value+='0'">
<input type="reset" value="Reset">
<input type="button" value="=" onClick="document.calculator.ans.value=eval(document.calculator.ans.value)">
</form>
</body>
</html>

the above file has 1405 bytes and esp8266 lua code above will only display part of it.
calling conn:on("sent",function(conn) conn:close() end) without checking file fits into a packet may be the error

If the functionality of multiple sends could be restored nodemcu could again be more valued as a server solution.
I'm having trouble getting html code served up since the multiple send feature was removed
User avatar
By alonewolfx2
#6589 yes i have same issue. zeroday said nothing changed but it doesnt work with new version.
User avatar
By Toshi Bass
#6601 Yeh I have same same issue why is it that conn:send code that works in 9.0.2 is broken in 9.0.4 and 9.0.5 its seams that every new firmware update, breaks something fundamental, I see no point in issuing updates unless some one explains why the change is for the better, I am getting very frustrated with nodelua, it bad enough to try learning a new language but to have stuff that you new worked broken, is really crappy.