Thanks a lot. But why is it required just for UDP? In TCP I can use "TCPServer.new some_ipv6, port" with no problem. Why UDPSocket requires special handling for IPv6?
Thanks a lot. But why is it required just for UDP? In TCP I can use "TCPServer.new some_ipv6, port" with no problem. Why UDPSocket requires special handling for IPv6?
The protocol (IPv4/IPv6) is determined at socket creation.
The argument of TCPServer.new(ipv6_address) makes Ruby to find that
the protocol is IPv6.
So TCPServer.new creates a socket for IPv6.
But Ruby cannot find the protocol for UDPSocket.new without arguments.
In that case, UDPScoket.new creates a socket for IPv4.
You meet an error when you use it for IPv6.
Iñaki, perhaps you should open a feature request for new methods, perhaps UDPSocket::bind and UDPSocket::connect which will determine the address family from the address given.
The existing Socket::udp_server_sockets may also help you, but I don't know if it uses bind or connect.
Iñaki, perhaps you should open a feature request for new methods, perhaps UDPSocket::bind and UDPSocket::connect which will determine the address family from the address given.