class EventMachine::EvmaTCPClient
@private
Public Class Methods
connect(bind_addr, bind_port, host, port)
click to toggle source
# File lib/em/pure_ruby.rb, line 647 def self.connect bind_addr, bind_port, host, port sd = Socket.new( Socket::AF_INET, Socket::SOCK_STREAM, 0 ) sd.bind( Socket.pack_sockaddr_in( bind_port, bind_addr )) if bind_addr begin # TODO, this assumes a current Ruby snapshot. # We need to degrade to a nonblocking connect otherwise. sd.connect_nonblock( Socket.pack_sockaddr_in( port, host )) rescue Errno::EINPROGRESS end EvmaTCPClient.new sd end
new(io)
click to toggle source
Calls superclass method
EventMachine::StreamObject.new
# File lib/em/pure_ruby.rb, line 661 def initialize io super @pending = true end
Public Instance Methods
eventable_write()
click to toggle source
Calls superclass method
EventMachine::StreamObject#eventable_write
# File lib/em/pure_ruby.rb, line 675 def eventable_write if @pending @pending = false if 0 == io.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR).unpack("i").first EventMachine::event_callback uuid, ConnectionCompleted, "" end else super end end
select_for_reading?()
click to toggle source
Calls superclass method
EventMachine::StreamObject#select_for_reading?
# File lib/em/pure_ruby.rb, line 671 def select_for_reading? @pending ? false : super end
select_for_writing?()
click to toggle source
Calls superclass method
EventMachine::StreamObject#select_for_writing?
# File lib/em/pure_ruby.rb, line 667 def select_for_writing? @pending ? true : super end