使用Nodemcu Esp8266 lua编程中的client:send()发送完整的html代码 [英] Send entire html code with client:send() in Nodemcu Esp8266 lua programming

查看:493
本文介绍了使用Nodemcu Esp8266 lua编程中的client:send()发送完整的html代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个lua文件,该文件实现了一个2relay模块来控制通过网站的滚动百叶窗.
我遵循了 led_webserver 示例,并从那里扩展了代码.
我尝试了多种方法来使用功能client:send()
发送完整的html页面 但这似乎不起作用.

I created a lua file that implements a 2relay module to control a rolling shutter through a website.
I followed the led_webserver example and I extended my code from there.
I tried so many ways to send a full html page with the function client:send(),
but it doesn't seem to work.

这是我自己开发的页面,可以在PC上使用,但是找不到方便的发送方式.
我声明一个包含所有html代码的局部变量(例如 test ),然后将其作为参数放入"client:send(test)"中.
有人知道另一种方式吗?

It's a page I developed myself and it works on the pc but I couldn't find an easy way to send it.
I declare a local variable (for example test) that contains all the html code and then i put it as parameter in `client:send(test).
Does someone know another way to do so?

推荐答案

eps8266上的TCP堆栈不支持跨IP数据包的流传输.每次发送最多可以包含一个完整的IP数据包,但可以更长.您已经使用soc:on("sent",callback)逐个数据包发送了它们.有关此内容的更多讨论,请参见 nodeMCU非官方常见问题解答.

The TCP stack on the eps8266 doesn't support streaming across IP packets. Each send can be up to one full IP packet but longer than that and you have send them packet by packet using the soc:on("sent",callback). See the nodeMCU Unofficial FAQ for more discussion of this.

这篇关于使用Nodemcu Esp8266 lua编程中的client:send()发送完整的html代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆