Class: Rev::TCPSocket::TCPConnectSocket

Inherits:
Socket
  • Object
show all
Defined in:
lib/rev/socket.rb

Instance Method Summary collapse

Constructor Details

#initialize(family, addr, port, host = addr) ⇒ TCPConnectSocket

Returns a new instance of TCPConnectSocket.



118
119
120
121
122
123
124
125
126
127
# File 'lib/rev/socket.rb', line 118

def initialize(family, addr, port, host = addr)
  @host, @addr, @port = host, addr, port
  @address_family = nil

  @socket = super(family, ::Socket::SOCK_STREAM, 0)
  begin
    @socket.connect_nonblock(::Socket.sockaddr_in(port, addr))
  rescue Errno::EINPROGRESS
  end
end

Instance Method Details

#peeraddrObject



129
130
131
132
133
134
135
136
# File 'lib/rev/socket.rb', line 129

def peeraddr
  [
    @address_family == ::Socket::AF_INET ? 'AF_INET' : 'AF_INET6',
    @port,
    @host,
    @addr
  ]
end