unpleasant new feature
Posted: Wed Jan 07, 2015 11:58 am
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.
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
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 all
httpserver = 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