---
name: "unix_telnet"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/unix_telnet"
---

# unix\_telnet(3erl)

Callback module for ct\_telnet, for connecting to a Telnet server on a UNIX host.

## NAME

unix\_telnet - Callback module for ct\_telnet, for connecting to a Telnet\
     server on a UNIX host.

## DESCRIPTION

Callback module for *ct\_telnet*, for connecting to a Telnet server on a UNIX host.

It requires the following entry in the configuration file:

```
 {unix,[{telnet,HostNameOrIpAddress},
        {port,PortNum},                 % optional
        {username,UserName},
        {password,Password},
        {keep_alive,Bool}]}.            % optional
```

To communicate through Telnet to the host specified by *HostNameOrIpAddress*, use the interface functions in *ct\_telnet*, for example, *open(Name)* and *cmd(Name,Cmd)*.

*Name* is the name you allocated to the Unix host in your *require* statement, for example:

```
 suite() -> [{require,Name,{unix,[telnet]}}].
```

or

```
 ct:require(Name,{unix,[telnet]}).
```

The "keep alive" activity (that is, that *Common Test* sends NOP to the server every 10 seconds if the connection is idle) can be enabled or disabled for one particular connection as described here. It can be disabled for all connections using *telnet\_settings* (see *ct\_telnet*).

The *{port,PortNum}* tuple is optional and if omitted, default Telnet port 23 is used. Also the *keep\_alive* tuple is optional, and the value default to *true* (enabled).

## EXPORTS

**connect(ConnName, Ip, Port, Timeout, KeepAlive, TCPNoDelay, Extra) -\> {ok, Handle} \| {error, Reason}**\

Types:

ConnName = target\_name()\
 Ip = string() \| {integer(), integer(), integer(), integer()}\
 Port = integer()\
 Timeout = integer()\
 KeepAlive = bool()\
 TCPNoDelay = bool()\
 Extra = target\_name() \| {Username, Password}\
 Username = string()\
 Password = string()\
 Handle = handle()\
 Reason = term()\

Callback for *ct\_telnet.erl*.

Setup Telnet connection to a Unix host.

For *target\_name()*, see *ct*. For *handle()*, see *ct\_telnet*.

**get\_prompt\_regexp() -\> PromptRegexp**\

Types:

PromptRegexp = prompt\_regexp()\

Callback for *ct\_telnet.erl*.

Returns a suitable *regexp* string matching common prompts for users on Unix hosts.

For *prompt\_regexp()*, see *ct\_telnet*.

## SEE ALSO

*ct*, *ct\_telnet*
