A Telnet client application that allows communication with an external Telnet server. More...
Methods | |
Close | |
Closes the Telnet session with the server and stops the Telnet client. More... | |
ConnectionState.Get | |
Returns the current TCP connection state. More... | |
Description.Get | |
Returns a textual description of the object. | |
Local.Port.Get | |
Returns the (local) TCP port used by this client. More... | |
Local.Port.Set port | |
Configures the (local) TCP port used by this client. More... | |
Open | |
Starts the Telnet client and opens the session with the Telnet server. More... | |
Parent.Get | |
Returns the parent object. | |
Receive | |
Reads data received over the Telnet session from the network and returns it. More... | |
Remote.Address.Get | |
Returns the IP address of the Telnet server to which this client connects. More... | |
Remote.Address.Set address | |
Sets the IP address of the Telnet server to which this client connects. More... | |
Remote.Port.Get | |
Returns the (remote) TCP port on the Telnet server to which this client connects.. More... | |
Remote.Port.Set port | |
Configures (remote) TCP port on the Telnet server to which this client connects. More... | |
Send data | |
Sends the provided to the Telnet server over the network.. More... | |
A Telnet client application that allows communication with an external Telnet server.
The Telnet protocol allows for bidirectional interactive communication between a Telnet client (i.e. this application) on a ByteBlower port and an external Telnet server.
The Telnet protocol can be used to log in on other machines using a virtual terminal. By sending Telnet commands using Send, waiting for a small amount of time and reading the respons using Receive, a complete interactive session may be constructed.
The protocol can also be used to debug other network protocols. For example, contacting an HTTP server (on port 80) using a Telnet client and sending a valid HTTP request towards it, should correctly return the HTTP response data.
Layer5.Telnet.Client::Close |
Closes the Telnet session with the server and stops the Telnet client.
The TCP session will be closed and reset, so a new session can be opened.
If no Telnet session is open, nothing is done.
This command closes the Telnet session if one is active.
Layer5.Telnet.Client::ConnectionState.Get |
Returns the current TCP connection state.
Returns:
TIME_WAIT
Layer5.Telnet.Client::Local.Port.Get |
Returns the (local) TCP port used by this client.
The client will communicate with the server through a TCP network socket on this port and listen on it for incoming traffic.
If the TCP port isn't explicitly set (yet), this will return a valid and unique TCP port number for within the scope of the ByteBlower port (e.g. 32687).
This example returns the port number on which this client connects to the Telnet server.
Returns:
40404
Layer5.Telnet.Client::Local.Port.Set | port | ||
Configures the (local) TCP port used by this client.
The client will communicate with the server through a TCP network socket on this port and listen on it for incoming traffic.
If the TCP port isn't explicitly set (yet), the server will use a valid and unique TCP port number for within the scope of the ByteBlower port (e.g. 32687).
port | The TCP port to be used by this client. This should be an integer value. Values larger the maximum port value of 65536 overflow into a valid port number. |
InvalidValue.Integer | If the parameter value isn't an integer, this exception is thrown. |
ByteBlower.Protocol.ConfigLocked | If a Telnet session is currently opened, this exception is thrown. Use Close to close the session before changing the Telnet server port. |
This snippet sets the port number on which this client will connect to the Telnet server.
Layer5.Telnet.Client::Open |
Starts the Telnet client and opens the session with the Telnet server.
It will create a new TCP connection. The TCP statistics will be reset. If a Telnet session is already open, nothing is done.
After calling this method, data may be sent to the server Send will be queued for transmission after this handshake.
ByteBlower.Protocol.Unavailable | If the Telnet server address has not been configured, this exception is thrown. Use Remote.Address.Set to configure the Telnet server address. |
This command opens the Telnet session, which initiates the handshake of the underlying TCP session. It returns immediately.
Layer5.Telnet.Client::Receive |
Reads data received over the Telnet session from the network and returns it.
If this method is executed, all received data since the last time it was called is returned. If more data is still flowing in from the network, the rest of the data will be returned the next time the receive method is executed.
ByteBlower.Protocol.InvalidAction | When no session is active, this exception is thrown. Use Open to open the session. |
This example shows the response received from the Telnet server after sending the 'uname -a' command.
Returns:
Linux mylaptop 3.5.0-43-generic #66~precise1-Ubuntu SMP Thu Oct 24 14:52:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Layer5.Telnet.Client::Remote.Address.Get |
Returns the IP address of the Telnet server to which this client connects.
Before this address is set, no connection can be opened or traffic can be sent.
Both IPv4 and IPv6 addresses are supported, but the provided (remote) address must match use the same IP protocol as the ByteBlower port of this client.
ByteBlower.Protocol.InvalidValue | If the remote IP address is not configured yet, this exception is thrown. |
This example returns the IP address of the Telnet server.
Returns:
10.8.65.65
Layer5.Telnet.Client::Remote.Address.Set | address | ||
Sets the IP address of the Telnet server to which this client connects.
Before this address is set, no connection can be opened or traffic can be sent.
Both IPv4 and IPv6 addresses are supported, but the provided (remote) address must match be of the same type as the ByteBlower port of this client.
address | The IP address of the Telnet server to which this client connects. This should be either an valid IPv4 address or a valid IPv6 address. |
ByteBlower.Exception.API.ConfigError | If an invalid IP address is entered, this error is thrown. |
ByteBlower.Protocol.InvalidValue | If an IPv4 address is provided, while this client is on an IPv6 ByteBlower port or vice versa, this exception is thrown. |
ByteBlower.Protocol.ConfigLocked | If a Telnet session is currently opened, this exception is thrown. Use Close to close the session before changing the Telnet server address. |
This snippet sets the IP address of the Telnet server to be contacted.
Layer5.Telnet.Client::Remote.Port.Get |
Returns the (remote) TCP port on the Telnet server to which this client connects..
The client will communicate with the Telnet server on the configured port.
If the TCP port isn't explicitly set (yet), this will return the default Telnet server port (23).
This example returns the port number of the Telnet server.
Returns:
2323
Layer5.Telnet.Client::Remote.Port.Set | port | ||
Configures (remote) TCP port on the Telnet server to which this client connects.
The client will communicate with the Telnet server on the configured port.
If the TCP port isn't explicitly set (yet), the server will take the default Telnet server port (23).
port | The TCP port on the Telnet server to which this client connects. This should be an integer value. Values larger the maximum port value of 65536 overflow into a valid port number. |
InvalidValue.Integer | If the parameter value isn't an integer, this exception is thrown. |
ByteBlower.Protocol.ConfigLocked | If a Telnet session is currently opened, this exception is thrown. Use Close to close the session before changing the Telnet server port. |
This snippet sets the port number of the Telnet server to be contacted.
Layer5.Telnet.Client::Send | data | ||
Sends the provided to the Telnet server over the network..
Data may be sent as soon as a connection is opened. Data sent during the TCP handshake will be queued to be sent immediately after it.
data | This string will be sent to the server for processing. |
ByteBlower.Protocol.InvalidAction | When no session is active, this exception is thrown. Use Open to open the session. |
This command sends the provided data over the network towards the Telnet server.