class

Telnet::Descriptor

Inherits Reference < Object

Descriptor class wraps an IO object and provides a parser for telnet protocol through the Parser class. It also contains the IO loop for reading data from the socket when it is a client type. The IO loop is started in its own fiber when the connection is established.

Constants

CONNECT_TIMEOUT = 5

Constructors

new(io : TCPSocket, type : Type)
Source

Class methods

new_client
Source

Instance methods

close
Source
connect(address : String, port : Int32 = 23) : Bool

Connect to a remote server Descriptor ends up calling TCPSocket#connect to establish the connection and we are wrapping the call so we can set @connected to true if the connection is successful. address is the address of the remote server port is the port to connect on (default is 23)

Source
connected?

If the descriptor is a Telnet::Client instance this allows us to know if we're connected to a server yet. This is not used by a server connection. The server connection status is determined by TCPSocket#closed?

Source
finalize
Source
type

The type of descriptor

Source
write(data : UInt8)

Write a byte to the socket

Source
write(data : Array(UInt8), escape : Bool = true)

Write an array of bytes to the socket

Source
write_command(data : Array(UInt8))
Source
write_command(data : Slice(UInt8))
Source

Macros

method_missing(call)

Forward missing methods to the TCPSocket object

Source

Nested types