Method: Addrinfo#to_s
- Defined in:
- raddrinfo.c
#to_sockaddr ⇒ String #to_s ⇒ String
returns the socket address as packed struct sockaddr string.
Addrinfo.tcp("localhost", 80).to_sockaddr
#=> "\x02\x00\x00P\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
2253 2254 2255 2256 2257 2258 2259 2260 |
# File 'raddrinfo.c', line 2253 static VALUE addrinfo_to_sockaddr(VALUE self) { rb_addrinfo_t *rai = get_addrinfo(self); VALUE ret; ret = rb_str_new((char*)&rai->addr, rai->sockaddr_len); return ret; } |