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/ip connect and maintain connection
#1
I am trying to place a resident script to connect to an ip address, monitor connection and reconnect if connection is lost.
I am reading and watching every tutorial i can find and am slowly getting more understanding but need others help with this.

I am after some guidance in the implementation of a TCP/ip connection to third party device (Symetrix DSP, control protocol same as control4, amx, crestron, lutron).
I have connection working between both the SHAC and the Symetrix DSP, as in I can ping it with a response through the "Network Utilities"
I have full control of Symetrix working through PuTTY terminal and now need to implement scripting to send, and manage received data.

Can anyone share with me scripting that will build this connection, maintain this connection, reconnect if device goes offline then returns online..
I have found multiple examples of this but am not getting much luck with connection or how to monitor if the connection is alive.


Code:
local socket = require("socket")
local host, port = "192.168.1.246", 48631
local tcp = assert(socket.tcp())


Once i have this connection up and running I need to build scripting to send controls to and receive pushed controls back to update GA's in the SHAC.

Control protocol info from Symetrix document shown below.

The Control Protocol is a text-based (ASCII string) protocol. Commands are sent with simple character strings with terms separated by spaces and completed with a carriage return character <CR> (ASCII code decimal 13). The general form for commands is:
<COMMAND> <PARAMETER1> <PARAMETER2> … <CR>

When in PuTTY if i send the command            CS 1 65535 <CR>        
I get Controller Set "CS" to controller number "1" set to maximum "65535" (all as expected) with a response of ACK.

Can I send this same data through a LUA script? or does it need to be converted to another format?
Reply


Messages In This Thread
TCP/ip connect and maintain connection - by Azar - 19.10.2023, 03:49

Forum Jump: