ip(p1)
public
returns an addrinfo object for IP address.
The port, socktype, protocol of the
result is filled by zero. So, it is not appropriate to create a socket.
Addrinfo.ip("localhost")
static VALUE
addrinfo_s_ip(VALUE self, VALUE host)
{
VALUE ret;
rb_addrinfo_t *rai;
ret = addrinfo_firstonly_new(host, Qnil,
INT2NUM(PF_UNSPEC), INT2FIX(0), INT2FIX(0), INT2FIX(0));
rai = get_addrinfo(ret);
rai->socktype = 0;
rai->protocol = 0;
return ret;
}