Telnet Javascript API
Connector functions Telnet JS API guide
This API allows users to execute operations in the Telnet connector from a connector function.
Telnet Object
The Telnet object is the main object of the Telnet connector. It allows to connect to a Telnet server, send commands and receive responses, and disconnect from the Telnet server.
Telnet Object Properties
Property | Type | Default | Description |
---|---|---|---|
ip | string | IP address of the Telnet server. | |
port | number | 23 | Port of the Telnet server. |
retries | number | 3 | Number of retries. |
timeout | number | 5000 | Timeout in milliseconds. |
Telnet Object Methods
connect (waitFor) ⇒ Object
Connects to the Telnet server using the properties of the Telnet object and the specified parameters.
Parameter | Type | Description |
---|---|---|
waitFor | string | String to wait for in the response. |
ip
: IP address of the Telnet server.port
: Port of the Telnet server.retries
: Number of retries.timeout
: Timeout in milliseconds.
Returns a object with the following properties:
result
:true
if the connection was successful,false
otherwise.message
: Empty if the connection was successful, error message otherwise.
send (command, pattern, waitFor) ⇒ Array
Sends a command to the Telnet server and waits for the response with the specified parameters:
Parameter | Type | Description |
---|---|---|
command | string | Command to send to the Telnet server. |
pattern | string | String to pattern match in the response. In RegExp format. |
waitFor | string | String to wait for in the response. If not specified, the default is > . |
retries
: Number of retries.timeout
: Timeout in milliseconds.
Returns the response of the Telnet server in an array of strings.
disconnect ()
Disconnects from the Telnet server.