tcp
This commit is contained in:
parent
94283a03a3
commit
b1ac19f887
@ -1,10 +1,21 @@
|
||||
local host, port = "meteo.ulgrad.ru", 4999
|
||||
local host, port = "ulgrad.ru", 4999
|
||||
local json = require('cjson.safe')
|
||||
local base64 = require('base64')
|
||||
local socket = require("socket")
|
||||
local tcp = assert(socket.tcp())
|
||||
local tcp = socket.tcp()
|
||||
|
||||
tcp:connect(host, port);
|
||||
--note the newline below
|
||||
tcp:send("thunder!");
|
||||
|
||||
local pack = {}
|
||||
pack['id'] = 'test'
|
||||
pack['room'] = {['temp'] = 12,['humi'] = 67}
|
||||
pack['cellar'] = {['temp'] = 14,['humi'] = 77}
|
||||
pack['weather'] = {['temp'] = 0,['humi'] = 57}
|
||||
pack['sensors'] = {['28:61:64:34:80:10:F4:39'] = 18,['28:61:64:35:18:1E:74:EB'] = 17,['28:61:64:35:18:3C:3D:61'] = 19}
|
||||
|
||||
--tcp:send(base64.encode(json.encode(pack)))
|
||||
|
||||
tcp:send('test')
|
||||
|
||||
while true do
|
||||
local s, status, partial = tcp:receive()
|
||||
|
||||
@ -1,2 +1,5 @@
|
||||
nc meteo.ulgrad.ru 4999
|
||||
nc chan.ulgrad.ru 4999
|
||||
nc 5.187.7.142 4999
|
||||
|
||||
nc chan.ulgrad.ru 4888
|
||||
nc 5.187.7.142 4888
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user