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.

Send Hex Values to an ser2net device
#2
Try this:
Code:
require('socket')

ip = '192.168.1.11'
port = 1234
data = string.char(0x08, 0x22, 0x00, 0x00, 0x00, 0x01, 0xd5)

sock = socket.tcp()
sock:settimeout(5)

res, err = sock:connect(ip, port)

if res then
  res, err = sock:send(data)

  if not res then
    alert('send error ' .. tostring(err))
  end
else
  alert('connect error ' .. tostring(err))
end

sock:close()
Reply


Messages In This Thread
RE: Send Hex Values to an ser2net device - by admin - 07.12.2016, 12:48

Forum Jump: