Tutorial:Send commands to the HMP using a Telnet client
From SpinetiX Support Wiki
This page is related to Shared Variables.
Telnet is a network protocol used on the Internet or local area networks to provide a bidirectional interactive text-oriented communication facility over TCP (the port used is usually 23, though in our case, it's typically 1234) using a virtual terminal connection. You can use different Telnet clients (e.g., Microsoft Telnet Client, PuTTY, Tera Term etc.) to connect to an HMP over the network and send commands using the TCP interface exposed by the Network API.
Note: The HMP doesn't implement the Telnet protocol (a "raw" TCP socket connection is done instead), therefore it will not send any feedback regarding the success of establishing a connection or the result of a command. Nevertheless, most Telnet clients will transparently switch to a raw TCP socket connection in such cases, even though a Telnet one was selected.
- Difficulty: Medium.
- Total duration: 5-10 minutes.
- Enable the Network API using HMP Control Center
- Open a connection toward the HMP from your Telnet client. (Instructions for three popular Telnet clients can be found below.)
- Using PuTTY:
- Open the application and enter the host name or IP address of the HMP.
- Set the port to 1234 (or to the value set manually)
- Set connection type to "Raw" or "Telnet" and press "Open".
- Using Tera Term:
- Open the application and under "Host" field, enter the host name or IP address of the HMP.
- Select the Telnet service and set the port to 1234 (or to the value set manually)
- Press "OK".
- Open Setup > Terminal; under New-line, set both options to "CR+LF", then enable "Local echo" and "Auto switch" options. Press "OK".
- Using Windows Telnet client:
- Press the Windows Start button and run the command: "telnet" (opens the Microsoft Telnet Client).
- Type "
SET LOCALECHO" and press "Enter". (See more about Telnet commands.)
- Type "
open HMP_address port"
HMP_addressis the host name or IP address of the HMP and
portis 1234 (or the value set manually).
- Press "Enter" (If the connection is successful, the cursor will move at the top of the window.)
- Using PuTTY:
- Type the following commands, one at the time. Make sure to press "Enter" after each command.
SUBSCRIBE "var1" UPDATE "var1" "some value" EVENT "mousedown" "x=33,y=44,button=0" EVENT "mouseup" "x=33,y=44,button=0"
Note: To send non-ASCII characters, make sure to set up the client to use UTF-8 character set.