https://github.com/guocf20/android_httpd
话说 Lua socket 还有点小 bug 。
local socket = require("socket")
local host, port = "127.0.0.1", 6000
local tcp = assert(socket.tcp())
tcp:connect(host, port); tcp:send("hello world\n");
while true do
local s, status, partial = tcp:receive("*l") // 这个地方如果是 tcp:receive("")直接报错
print(s or partial)
if status == "closed" then
break
end
end
tcp:close()
