This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Reading event notifications from Grandstream GDS3710
#3
(13.04.2023, 08:55)admin Wrote: Try this:
Code:
local socket = require("socket")
local server = assert(socket.bind("*", 7777))
local crlf = '\r\n'

while true do
  local client = server:accept()

  client:settimeout(5)

  local pat, len

  while true do
    local res, err = client:receive(pat)

    if err then
      break
    end

    if type(pat) == 'number' then
      client:send(
        'HTTP/1.1 200 OK' .. crlf ..
        'Connection: close' .. crlf .. crlf
      )

      log(res) -- contains request body

      break
    elseif #res == 0 then
      pat = len
    elseif not len then
      len = res:match('Content%-Length: (%d+)')
      len = tonumber(len)
    end
  end

  client:close()
end

Works as a charm! 
Thank you very much admin! Cool
Reply


Messages In This Thread
RE: Reading event notifications from Grandstream GDS3710 - by tigi - 13.04.2023, 09:06

Forum Jump: