local socket = require(“socket”)
host = “127.0.0.1”
port = 3563
net_work = assert(socket.connect(host, port))
content = ‘{“LoginInfo”:{“Name”: “cxn8801″,”Pwd”:”123abc”}}’
data = string.char(math.floor(string.len(content)/128)) .. string.char(string.len(content)%128) .. content
net_work:send(data)
head = net_work:receive(2)
len = string.byte(head, 1) * 1024 + string.byte(head, 2)
msg, err, part = net_work:receive(len)
print(msg)
lua 与 leafserver 通信 (大端)
最新推荐文章于 2023-04-04 16:43:06 发布