我使用nodemcu与esp-32,最近遇到了一个恼人的问题.我从NodeMCU Github页面引用这个示例:
-- a simple HTTP server
srv = net.createServer(net.TCP)
srv:listen(80, function(conn)
conn:on("receive", function(sck, payload)
print(payload)
sck:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n<h1> Hello, NodeMCU.</h1>")
end)
conn:on("sent", function(sck) sck:close() end)
end)
Run Code Online (Sandbox Code Playgroud)
这似乎并不适用于所有情况.如果我用telnet试试,没有问题:
$ telnet 172.17.10.59 80
Trying 172.17.10.59...
Connected to 172.17.10.59.
Escape character is '^]'.
GET / HTTP/1.1
HTTP/1.0 200 OK
Content-Type: text/html
<h1> Hello, NodeMCU.</h1>
Connection closed by foreign host.
Run Code Online (Sandbox Code Playgroud)
但是当使用wget时,它大部分时间都会挂起:
$ wget http://172.17.10.59/
--2017-05-12 15:00:09-- http://172.17.10.59/
Connecting to 172.17.10.59:80... connected.
HTTP request sent, awaiting response... …Run Code Online (Sandbox Code Playgroud) 如果我有一个xtype int,如何获取xLSB 的值并将数字中的所有其他位设置为该LSB?
我一直在与位运算符和逻辑运算符打交道,这有点(没有双关语),我知道它们是如何工作的。
移位运算符x >> 3和x << 3左,右分别×3位的位移位,我知道我们可以使用运营商如^ |和&为瞎搞与操纵位。我在理解此特定问题的逻辑时遇到了麻烦。
编辑:我们被允许用于此的运算符是!〜&^ | + << >>