This code also works and the timeout syntax is more consistent with the example from the wiki (getting that part right may be a good idea based on Richard's comment):
local http = require "socket.http"
local ltn12 = require "ltn12"
local util = require "util"
http.timeout = 5
local body, code, headers, status = http.request {
method = "POST",
url = "http://192.168.0.235:8060/keypress/Back",
source = ltn12.source.string(reqbody),
headers =
{
["Connection"] = "Close",
["Content-Type"] = "application/x-www-form-urlencoded",
a },
sink = ltn12.sink.table(respbody)
}
There are lines in there that are almost certainly unneeded. Some may argue that it is worthwhile to whittle away the excess until you have code that does what you need without doing anything else.