mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
* ext/socket/socket.c (socket_s_list_ip_address): new method.
(sockaddr_obj): new function. * ext/socket/rubysocket.h: include ifaddrs.h, sys/ioctl.h, sys/sockio.h, net/if.h if available. (addrinfo_new): declared. * ext/socket/raddrinfo.c (addrinfo_new): exported. * ext/socket/extconf.rb: check ifaddrs.h, sys/ioctl.h, sys/sockio.h, net/if.h and getifaddrs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9ffca4659b
commit
bd3cdcf394
6 changed files with 281 additions and 1 deletions
|
@ -54,4 +54,16 @@ class TestSocket < Test::Unit::TestCase
|
|||
def test_getnameinfo
|
||||
assert_raise(SocketError) { Socket.getnameinfo(["AF_UNIX", 80, "0.0.0.0"]) }
|
||||
end
|
||||
|
||||
def test_list_ip_address
|
||||
begin
|
||||
list = Socket.list_ip_address
|
||||
rescue NotImplementedError
|
||||
return
|
||||
end
|
||||
list.each {|ai|
|
||||
assert_instance_of(AddrInfo, ai)
|
||||
assert(ai.ip?)
|
||||
}
|
||||
end
|
||||
end if defined?(Socket)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue