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
#2
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
Reply


Messages In This Thread
RE: Reading event notifications from Grandstream GDS3710 - by admin - 13.04.2023, 08:55

Forum Jump: