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.

TCP Socket Connection for Legrand
#8
This is not a proper protocol implementation, but see if this works for you:
Code:
function openwebnetcmd(ip, cmd)
  local socket = require('socket')
  local eot = string.char(4)
  local sock = socket.tcp()

  sock:settimeout(1)

  local res, err = sock:connect(ip, 20000)
  if not res then
    alert('connect failed ' .. tostring(err))
    return
  end

  os.sleep(1)
  sock:send('*99*0##' .. eot)

  os.sleep(1)
  sock:send(cmd .. eot)

  os.sleep(1)
  sock:close()

  return true
end

openwebnetcmd('192.168.1.1', '*1*1*11##')
Reply


Messages In This Thread
RE: TCP Socket Connection for Legrand - by admin - 07.05.2019, 06:43

Forum Jump: