class EaseEngine::TCPSocket
Attributes
is_heartbeat[RW]
is_timeout[RW]
Public Class Methods
new( *args )
click to toggle source
Calls superclass method
EaseEngine::Socket::new
# File lib/ease_engine/socket.rb, line 102 def initialize( *args ) super @is_heartbeat = false @is_timeout = false case args.length when 1 @socket = args[ 0 ] when 2 @dst_addr = ::TCPSocket.gethostbyname( args[ 0 ] ) @dst_addr.push args[ 1 ] @socket = ::Socket.new( @dst_addr[ 2 ], ::Socket::SOCK_STREAM, 0 ) connect end end
Public Instance Methods
connect()
click to toggle source
# File lib/ease_engine/socket.rb, line 119 def connect @err = nil begin @socket.connect_nonblock( ::Socket.sockaddr_in( @dst_addr.last, @dst_addr[ 3 ] ) ) rescue => err @err = err end end
recv( max, flags = 0 )
click to toggle source
Calls superclass method
EaseEngine::Socket#recv
# File lib/ease_engine/socket.rb, line 128 def recv( max, flags = 0 ) @is_timeout = false super( max, flags ) end