我在我的 ESP-12 上运行了一个带有 nodemcu 固件的小型 Web 服务器:
sv=net.createServer(net.TCP,10)
sv:listen(80,function(c)
c:on("receive", function(c, pl)
if(string.find(pl,"GET / ")) then
print("Asking for index")
c:send("Line 1")
c:send("Line 2")
c:send("Line 3")
c:close()
end
end)
c:on("sent",function(conn)
print("sended something...")
end)
end)
似乎我的连接在第一次发送后关闭,在我的浏览器中我只看到“第 1 行”文本,第 2 a 3 行没有出现,在我的串行控制台中我只看到一次“发送的东西”文本,即使评论关闭语句并让连接超时也不会改变行为。我在这里想念什么?