Class: NetworkFacade::TCP::Client

Inherits:
Base::Client show all
Defined in:
lib/network-facade/tcp.rb

Instance Method Summary collapse

Methods inherited from Base::Client

#__read__, #__write__, inherited, #method_missing, uri=

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



15
16
17
18
19
20
21
22
# File 'lib/network-facade/tcp.rb', line 15

def initialize(options = {})
	super
	@uri.host = 'localhost' if @uri.host.nil? or @uri.host.empty?
	@uri.port = PORT if @uri.port.nil?
	@options[:no_delay] ||= true
	@client ||= TCPSocket.new(@uri.host, @uri.port)
	@client.setsockopt(Socket::SOL_TCP, Socket::TCP_NODELAY, 1) if @options[:no_delay]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NetworkFacade::Base::Client