<div dir="ltr"><div><div><div><div><div>Hello,<br><br></div>I've tried to use Twisted names.client.getHostByName() method to resolve some addresses for my UDP based app. By default getHostByName() always returns IPv6 address. I don't always have end-to-end IPv6 connectivity, so it often causes communication to fail. I've found a solution to override this behavior with monkey patching [1].<br>
<br></div>After Twisted 13.2 announcement I've checked the new HostnameEndpoint implementation to find possible solution (it seems to be dedicated to solve similar problems, but for TCP-based protocols). However it seems to use deferToThread(), and built-in Python getaddrinfo().<br>
<br></div>My questions:<br></div>1. Is using deferToThread() a preferred solution?<br></div>2. Does someone know a less hacky solution to get IPv4 addresses with getHostbyName()?<br><div><div><div><div><div><br></div><div>
Best Regards<br></div><div>Maciej Wasilak<br></div><div><br>[1] <a href="http://stackoverflow.com/questions/13820175/can-twisted-names-client-be-forced-to-return-ipv4-addresses-without-modifying">http://stackoverflow.com/questions/13820175/can-twisted-names-client-be-forced-to-return-ipv4-addresses-without-modifying</a><br>
</div></div></div></div></div></div>