Skip to main content

Telnet

Connecting to a remote server using Telnet This example demonstrates how to connect to a device in iRidi Studio using the AV & Custom Systems (TCP) driver.

Documentation updated 01.01.2024

Tip

Download: example project

To process received data and/or control equipment, you can use the AV_Custom_Systems_(TCP,_UDP,_RS232) driver. This requires iRidi Studio installed on a PC and any Telnet server. In this example, we connect to HK-Telnet Server.

Creating a user in HK-Telnet:​

  1. Start HK-Telnet Server

  2. Click CREATE USER

HK-Telnet.png

  1. Specify a username and password for the user

HK-Telnet_createuser.jpg

HK-Telnet_createpass.jpg

Connecting using Command Prompt:​

  1. Start Command Prompt

  2. Enter the command "telnet"

Cmd_telnet.jpg

  1. Enter the command "open" followed by the IP address of the remote server to connect to

Cmd_telnet_open.jpg

  1. Enter the username and password of the user you created

Cmd_telnet_auth.jpg

After a successful connection, you can run commands from the terminal

Cmd_telnet_authcomplete.jpg

Working in iRidi Studio:​

  1. Start iRidi Studio and create an AV & Custom Systems (TCP) project driver. In the driver properties, set Host to the IP address of the server and Port to 23. This is the server on which you will sign in and send commands from i3 pro.

  2. To sign in, use JS methods in the Script Editor built into iRidi Studio. Create a new script in Studio and paste the code below. Replace 'login' and 'password' with the credentials of the user you created in Telnet Server:

IR.AddListener(IR.EVENT_RECEIVE_TEXT, IR.GetDevice('AV_Device'), function(text)
{
IR.Log("text = " + text);

if (text.indexOf('Username') != -1)
{
IR.Log("login")
IR.GetDevice('AV_Device').Send(['login',13,10]);
} else if (text.indexOf('Password') != -1)
{
IR.Log("password")
IR.GetDevice('AV_Device').Send(['password',13,10]);
}
})
  1. After entering all the details, run the project and check that it works. If the details are correct, the log shows the username (USERNAME = TestUser), the connection confirmation "Welcome to Hadi Kiamarsi TELNET Server", and the IP address.

Log_succ.png

Sending commands to the server from i3 pro:​

  1. Create 2 Button items to send commands to the server. This example uses "ping" and "tree" (which displays all folders in the current directory).

I3pro_buttons.jpg

  1. For each button, create functions that run the command using the Send method
function ping(){
IR.GetDevice('AV_Device').Send(['ping iridi.com',13,10]);
};

function tree(){
IR.GetDevice('AV_Device').Send(['tree',13,10]);
}
  1. The commands produce the following data in the i3 pro logs

I3pro_ping_iridi.jpg

I3pro_tree.jpg