Fuego.Net : TelnetServer

The TelnetServer component is used to connect to and send commands to a Telnet server.

To connect to a telnet server you must specify host, password, port and prompt. The prompt value is needed to detect command output termination accurately.

Important: Telnet sessions are not encrypted. For secure communications using the SSH protocol use the SecureShell component.

Example

The following example connects to the server, changes the prompt and invokes some commands.

user = "example_user"
host = "example_host"
connectTo TelnetServer 
    using host = host, 
        port = 23, 
        user = user, 
        password = "example_password", 
        prompt = user + "@" + host 
 
commandResult as String 
 
// Setting prompt to a constant value (working directory is not included) 
commandResult = sendCommandTo(TelnetServer, command : "export PS1=\"\\u@\\h>\"") 
TelnetServer.prompt = user + "@" + host + ">" 
 
commandResult = sendCommandTo(TelnetServer, command : "ls -la") 
display commandResult 
 
commandResult = sendCommandTo(TelnetServer, command : "pwd") 
display commandResult 
Related reference
Fuego.Net : SecureShell