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.

Arcam control over ip
#2
Try this:
Code:
function tcp_arcam(data, ip, port)
  local sock, res, err, len

  sock = require('socket').tcp()
  sock:settimeout(1)

  res, err = sock:connect(ip, port or 50000)
  
  if res then
    -- send data
    sock:send(data)

    -- receive response
    res, err = sock:receive(5)
    if type(res) == 'string' and #res == 5 then
      len = res:byte(5)
      res, err = sock:receive(len + 1)
    else
      alert('receive failed: ' .. tostring(err))
    end
  else
    alert('connect failed: ' .. tostring(err))
  end

  sock:close()

  return res, err
end
Reply


Messages In This Thread
Arcam control over ip - by Thinklight - 03.12.2018, 15:03
RE: Arcam control over ip - by admin - 04.12.2018, 07:16
RE: Arcam control over ip - by Thinklight - 04.12.2018, 09:57
RE: Arcam control over ip - by admin - 04.12.2018, 10:01
RE: Arcam control over ip - by Thinklight - 04.12.2018, 10:10
RE: Arcam control over ip - by admin - 04.12.2018, 10:16
RE: Arcam control over ip - by Thinklight - 04.12.2018, 10:25
RE: Arcam control over ip - by Thinklight - 05.12.2018, 11:25
RE: Arcam control over ip - by admin - 07.12.2018, 10:53

Forum Jump: