Class: TelnetQ::SocketQ

Inherits:
Base
  • Object
show all
Defined in:
lib/telnet_q/socket_q.rb

Constant Summary collapse

VERB_NAMES =
{
  251 => :will,
  252 => :wont,
  253 => :do,
  254 => :dont,
}.freeze
VERB_NUMS =
VERB_NAMES.invert.freeze

Instance Method Summary collapse

Methods inherited from Base

#enabled?, #forbid, #inspect, #received_message, #request, #start

Constructor Details

#initialize(connection, options = {}) ⇒ SocketQ

Returns a new instance of SocketQ.



15
16
17
18
# File 'lib/telnet_q/socket_q.rb', line 15

def initialize(connection, options={})
  @connection = connection
  super(options)
end

Instance Method Details

#received_raw_message(raw) ⇒ Object

Invoke this when a TELNET negotiation message is received.

Example usage:

sq = TelnetQ::SocketQ.new(connection, ...)
sq.received_raw_message("\377\375\000")       # Remote party requesting that we enable binary transmission on our side
sq.received_raw_message("\377\373\000")     # Remote party requesting that to enable binary transmission on his side.


26
27
28
29
# File 'lib/telnet_q/socket_q.rb', line 26

def received_raw_message(raw)
  verb, option = parse_raw_telnet_option_message(raw)
  received_message(verb, option)
end