Class: UDPSocket
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::IPSocket
|
|
Instance Chain:
self,
::IPSocket
|
|
Inherits: |
IPSocket
|
Defined in: | lib/resolv-replace.rb |
Class Method Summary
::IPSocket - Inherited
Instance Method Summary
- #bind(host, port)
- #connect(host, port)
- #send(mesg, flags, *rest)
- #original_resolv_bind Internal use only
- #original_resolv_connect Internal use only
- #original_resolv_send Internal use only
Instance Method Details
#bind(host, port)
[ GitHub ]# File 'lib/resolv-replace.rb', line 33
def bind(host, port) host = IPSocket.getaddress(host) if host != "" original_resolv_bind(host, port) end
#connect(host, port)
[ GitHub ]# File 'lib/resolv-replace.rb', line 41
def connect(host, port) original_resolv_connect(IPSocket.getaddress(host), port) end
#original_resolv_bind
This method is for internal use only.
[ GitHub ]
# File 'lib/resolv-replace.rb', line 31
alias original_resolv_bind bind
#original_resolv_connect
This method is for internal use only.
[ GitHub ]
# File 'lib/resolv-replace.rb', line 39
alias original_resolv_connect connect
#original_resolv_send
This method is for internal use only.
[ GitHub ]
# File 'lib/resolv-replace.rb', line 46
alias original_resolv_send send
#send(mesg, flags, *rest)
[ GitHub ]# File 'lib/resolv-replace.rb', line 48
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 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