Class: GQTP::Connection::Thread::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/gqtp/connection/thread.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



73
74
75
76
77
78
79
# File 'lib/gqtp/connection/thread.rb', line 73

def initialize(options={})
  @options = options
  @address = options[:address] || "127.0.0.1"
  @port = options[:port] || 10041
  @socket = TCPSocket.open(@address, @port)
  @io = IO.new(@socket)
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



72
73
74
# File 'lib/gqtp/connection/thread.rb', line 72

def address
  @address
end

#portObject

Returns the value of attribute port.



72
73
74
# File 'lib/gqtp/connection/thread.rb', line 72

def port
  @port
end

Instance Method Details

#closeObject



89
90
91
# File 'lib/gqtp/connection/thread.rb', line 89

def close
  @io.close
end

#read(size = nil, &block) ⇒ Object



85
86
87
# File 'lib/gqtp/connection/thread.rb', line 85

def read(size=nil, &block)
  @io.read(size, &block)
end

#write(*chunks, &block) ⇒ Object



81
82
83
# File 'lib/gqtp/connection/thread.rb', line 81

def write(*chunks, &block)
  @io.write(*chunks, &block)
end