SimpleUDPClient with 'localhost' defaults to ipv6 but OSCUDPServer has no ipv6 support
Ran into all our OSC failing after updating to 1.7.4 from 1.7.2. Turns out that because of the newly added ipv6 support, our client with address 'localhost' is now only putting out messages on ipv6. Our corresponding server (OSCUDPServer) is hosting on 'localhost' which still defaults to ipv4. In fast when we try to give it an ipv6 address ('::1') it fails because the underlying socketserver uses the socket.AF_INET address family, which doesn't understand ipv6 addresses.
def server_bind(self):
"""Called by constructor to bind the socket.
May be overridden.
"""
if self.allow_reuse_address:
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
> self.socket.bind(self.server_address)
E socket.gaierror: [Errno 11001] getaddrinfo failed
..\..\..\Anaconda3\envs\narupa-dev\lib\socketserver.py:466: gaierror
I am able to work around this with the following subclass, but it was certainly very confusing that server and client behave in different ways given the same localhost address, and also that the underlying socket errors are so esoteric.
class ThreadingOSCUDPServerV6(ThreadingOSCUDPServer):
address_family = socket.AF_INET6
As far as I can tell socket.AF_INET6 doesn't understand ipv4 address so I'm not sure if there's any easy way to support both seamlessly.
Actually, there seems to be socket.AF_UNSPEC but I haven't yet worked out how to make it work.