tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Using the Tomcat Native Library can only connect over ipv6 But not over ipv4
Date Mon, 26 Nov 2012 20:14:33 GMT
Jeffrey Janner wrote:
>> -----Original Message-----
>> From: Christopher Schultz []
>> Sent: Monday, November 26, 2012 1:17 PM
>> To: Tomcat Users List
>> Subject: Re: Using the Tomcat Native Library can only connect over ipv6
>> But not over ipv4
>> Hash: SHA1
>> Zorro,
>> On 11/23/12 4:37 PM, Zorro wrote:
>>> its not really a problem but if we ever migrate the internet to
>>> IPv6 it would be brilliant to have the connector serving both
>>> protocols which the http-bio-80 connector seems to be able to do
>> Let me double-check: are you saying that Tomcat/APR will only do IPv4
>> *or* IPv6 but not both? ... and that the BIO and NIO connectors *will*
>> allow both?
>> - -chris
> Chris -
> This has long been an issue with the Windows version of APR.
> If you leave off the "address=" parameter of the connector, it will default to IPv6 only.
> The workaround I've been using for years is the "address=" feature, since I'm
an IPv4 only setup.
> Theoretically, it should set up both connections, but doesn't.
> I'm not sure if anyone's ever found a reason for this behavior, but it does only seem
to affect APR connections.
> You can search back in history a year or so for more detailed analysis if you'd like.
 (search for my posts on the subject.)
> Jeff

Note that as per earlier in this thread, there is a workaround, consisting of defining 2 
<Connector>s, one for IPv4 and one for IPv6, both on the same port, 80 e.g.

Also, I don't know if this is really relevant here, but I seem to remember a parameter or

attribute somewhere named "preferIPv4Stack"/"preferIPv6Stack".
Ok, I was digging a bit deeper in Google, and this is by no means an authoritative 
explanation, just my take on it so far :
At least some versions of Windows seem to have 2 independent IP stacks, one for IPv4 and 
one for IPv6.  (As opposed to one IPv6 stack which can also "do IPv4" when required).
And natively under such an OS, one cannot bind a server socket to both an IPv4 and an IPv6

address; one needs two separate sockets.  Apparently also, the JVM can to some extend 
"hide" this from Java programs, and perform it's magic under the hood, binding to one or 
the other or both as required, while still making it look as one socket to the Java program.
(wild guess : maybe that APR, being "native" and closer to the OS, doesn't allow this, 
while the other Connector variations do).

You can still open 2 separate <Connector>s though.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message