specifying address family before establishing connection

Marc Lehmann schmorp at schmorp.de
Tue May 10 10:45:01 CEST 2011


On Mon, May 09, 2011 at 09:57:51PM +0200, "Brane F. Gračnar" <brane.gracnar at najdi.si> wrote:
> I'd like to specify address family before issuing TCP connects.  I have a list 
> of hostnames, both accessible via ipv6 and ipv4.
> 
> I'd like to connect to some of them using only ipv6 and to some of them using 
> only ipv4.
> 
> Is it possible to achieve this just by setting $ENV{PERL_ANYEVENT_PROTOCOLS} 
> before calling tcp_connect()?

No - but you can first resolve and then pass in the ip addresss to
tcp_connect.

> What about AnyEvent::HTTP?

AnyEvent::HTTP doesn't support any extensions to the http protocol that
would allow you to select ipv6 vs. ipv4 transport, however, you can
provide your own tcp_connect callback, and in there, resolve the hostname
in whatever way you like.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the anyevent mailing list