class Socket::ResolutionError
Socket::ResolutionError is the error class for hostname resolution.
Public Instance Methods
Source
static VALUE
sock_resolv_error_code(VALUE self)
{
return rb_attr_get(self, id_error_code);
} Returns the raw error code indicating the cause of the hostname resolution failure.
begin
Addrinfo.getaddrinfo("ruby-lang.org", nil)
rescue Socket::ResolutionError => e
if e.error_code == Socket::EAI_AGAIN
puts "Temporary failure in name resolution."
end
end
Note that error codes depend on the operating system.
Ruby Core © 1993–2024 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.