Here is my code:
local postdata="testdata"
local postLength=string.len(postdata)
local sck=net.createConnection(net.TCP, 0)
sck:on("receive", function(sck, payload)
print("received")
print(payload)
sck:close()
end)
sck:on("sent",function(sck)
print("sent")
end)
sck:on("disconnection", function(sck)
print("disconnection...")
sck = nill
end)
sck:on("connection",function(sck)
print("connected")
sck:send("POST /MyService/api/Measure HTTP/1.1\r\nHost: xxxxxxxxxx.com\r\n"
.."Connection: keep-alive\r\n"
.."Cache-Control: no-cache\r\nContent-Type: application/json"
.."\r\nContent-Length: "..postLength.."\r\nAccept: */*\r\n\r\n"
..postdata)
end)
print("connection...")
sck:connect(80,'xxxxxxxxxx.com') Sometimes I have this output:
connection...
connected
sent
received
content of the payload
disconnection...
but after a while (sometimes even from the beginning) I have:
connection...
disconnection...
anyone ever had this type of issue?
Thank you