Class: Rakie::TCPChannel
Direct Known Subclasses
Constant Summary collapse
- LOCAL_HOST =
'127.0.0.1'
Constants inherited from Channel
Instance Attribute Summary
Attributes inherited from Channel
Instance Method Summary collapse
-
#initialize(host = LOCAL_HOST, port = 3001, delegate = nil, socket = nil) ⇒ TCPChannel
constructor
A new instance of TCPChannel.
Methods inherited from Channel
#close, #closed?, #eof?, #handle_write, #on_detach, #on_read, #on_write, #read, #write
Constructor Details
#initialize(host, port, delegate) ⇒ TCPChannel #initialize(host, port) ⇒ TCPChannel #initialize(host, port, delegate, socket) ⇒ TCPChannel
Returns a new instance of TCPChannel.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rakie/tcp_channel.rb', line 12 def initialize(host=LOCAL_HOST, port=3001, delegate=nil, socket=nil) if socket == nil socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM) socket.connect(Socket.pack_sockaddr_in(port, host)) end @port = port @host = host super(socket, delegate) end |