Class: Rev::TCPSocket::TCPConnectSocket
- Inherits:
-
Object
- Object
- Rev::TCPSocket::TCPConnectSocket
- Defined in:
- lib/internethakai/hakairev/monkey.rb
Constant Summary collapse
- @@_cache =
{}
Instance Method Summary collapse
-
#initialize(family, addr, port, host = addr) ⇒ TCPConnectSocket
constructor
A new instance of TCPConnectSocket.
Constructor Details
#initialize(family, addr, port, host = addr) ⇒ TCPConnectSocket
Returns a new instance of TCPConnectSocket.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/internethakai/hakairev/monkey.rb', line 11 def initialize(family, addr, port, host = addr) #バグがあったので上書き @host, @addr, @port = host, addr, port @address_family = nil @socket = super(family, ::Socket::SOCK_STREAM, 0) begin key = port.to_s + addr if @@_cache[key] addrin = @@_cache[key] else addrin = @@_cache[key] = ::Socket.sockaddr_in(port, addr) end @socket.connect_nonblock(addrin) rescue Errno::EINPROGRESS end end |