class Telnet::Descriptor

Overview

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.

Defined in:

telnet/descriptor.cr

Constant Summary

CONNECT_TIMEOUT = 5

Constructors

Class Method Summary

Macro Summary

Instance Method Summary

Constructor Detail

def self.new(io : TCPSocket, type : Type) #

[View source]

Class Method Detail

def self.new_client #

[View source]

Macro Detail

macro method_missing(call) #

Forward missing methods to the TCPSocket object


[View source]

Instance Method Detail

def close #

[View source]
def 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)


[View source]
def connected? : Bool #

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?


[View source]
def finalize #

[View source]
def type : Type #

The type of descriptor


[View source]
def write(data : UInt8) #

Write a byte to the socket


[View source]
def write(data : Array(UInt8), escape : Bool = true) #

Write an array of bytes to the socket


[View source]
def write_command(data : Array(UInt8)) #

[View source]
def write_command(data : Slice(UInt8)) #

[View source]