### Home Classes Methods

### In Files

- lib/cool.io/socket.rb

### Parent

Coolio::DNSResolver

### Methods

- ::new
- #on_failure
- #on_success

### Class/Module Index

Quicksearch

- Coolio
- Coolio::AsyncWatcher
- Coolio::Connections
- Coolio::DNSResolver
- Coolio::DNSResolver::Timeout
- Coolio::DSL
- Coolio::DSL::ConnectionBuilder
- Coolio::IO
- Coolio::IO::Watcher
- Coolio::IOWatcher
- Coolio::Listener
- Coolio::Loop
- Coolio::Meta
- Coolio::Server
- Coolio::Socket
- Coolio::Socket::Connector
- Coolio::TCPListener
- Coolio::TCPServer
- Coolio::TCPSocket
- Coolio::TCPSocket::TCPConnectResolver
- Coolio::TCPSocket::TCPConnectSocket
- Coolio::TimerWatcher
- Coolio::UNIXListener
- Coolio::UNIXServer
- Coolio::UNIXSocket
- Cool
- Cool::Coolness
- Cool::IOThunk
- Object
- Thread

No matching classes.

# Coolio::TCPSocket::TCPConnectResolver

### Public Class Methods

new(socket, host, port, *args) click to toggle source

    # File lib/cool.io/socket.rb, line 180
    def initialize(socket, host, port, *args)
      @sock, @host, @port, @args = socket, host, port, args
      super(host)
    end

### Public Instance Methods

on_failure() click to toggle source

    # File lib/cool.io/socket.rb, line 204
    def on_failure
      @sock.__send__(:on_resolve_failed)
      @sock.instance_eval do
        @_resolver = nil
        @_failed = true
      end
      return
    end

on_success(addr) click to toggle source

    # File lib/cool.io/socket.rb, line 185
    def on_success(addr)
      host, port, args = @host, @port, @args

      @sock.instance_eval do
        # DNSResolver only supports IPv4 so we can safely assume IPv4 address
        begin
          socket = TCPConnectSocket.new(::Socket::AF_INET, addr, port, host)
        rescue Errno::ENETUNREACH
          on_connect_failed
          return
        end

        initialize(socket, *args)
        @_connector = Socket::Connector.new(self, socket)
        @_resolver = nil
      end
      @sock.attach(evloop)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.