Class: UDPSocket

Class | UDPSocket
In: | resolv-replace.rb
Parent: | Object

### Methods

bind connect send

### External Aliases

bind | -> | original_resolv_bind
connect | -> | original_resolv_connect
send | -> | original_resolv_send

### Public Instance methods

bind(host, port)

[Source]

    # File resolv-replace.rb, line 25
      def bind(host, port)
        original_resolv_bind(IPSocket.getaddress(host), port)
      end

connect(host, port)

[Source]

    # File resolv-replace.rb, line 30
      def connect(host, port)
        original_resolv_connect(IPSocket.getaddress(host), port)
      end

send(mesg, flags, *rest)

[Source]

    # File resolv-replace.rb, line 35
      def send(mesg, flags, *rest)
        if rest.length == 2
          host, port = rest
          begin
            addrs = Resolv.getaddresses(host)
          rescue Resolv::ResolvError
            raise SocketError, "Hostname not known: #{host}"
          end
          err = nil
          addrs[0...-1].each {|addr|
            begin
              return original_resolv_send(mesg, flags, addr, port)
            rescue SystemCallError
            end
          }
          original_resolv_send(mesg, flags, addrs[-1], port)
        else
          original_resolv_send(mesg, flags, *rest)
        end
      end

[Validate]