tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Phelps <nphe...@solarc.com>
Subject RE: Tomcat 4.1.12 taking IPs or Ports not assigned to it?
Date Sat, 26 Oct 2002 16:04:21 GMT
> It's by design.

Tomcat design or JVM design?  After doing more research I have determined
that this effects all use of ServerSocket in Java.  So are we saying this is
not a bug?  This is the way Sun designed it to work?  Why?

Here is a test app I used to conclude that it effects all instances of
ServerSocket.

public static void main(String[] args) {
    try {
        java.net.ServerSocket serverSocketOne = new java.net.ServerSocket();
        java.net.ServerSocket serverSocketTwo = new java.net.ServerSocket();

        java.net.InetAddress bindAddressOne = 
                                    java.net.InetAddress.getByName(args[0]);

        java.net.InetAddress bindAddressTwo =
                                    java.net.InetAddress.getByName(args[0]);

        java.net.InetSocketAddress socketAddressOne = 
                                    new java.net.InetSocketAddress(
                                        bindAddressOne, Integer.valueOf(
                                            args[2]).intValue());

        java.net.InetSocketAddress socketAddressTwo = 
                                    new java.net.InetSocketAddress(
                                        bindAddressTwo, Integer.valueOf(
                                            args[2]).intValue());

        System.out.println("About to bind to " + 
                           bindAddressOne.getHostAddress() + ":" + args[2]);

        serverSocketOne.bind(socketAddressOne);
        if (!serverSocketOne.isBound()) {
            System.out.println("Couldn't bind to " + 
                                           bindAddressOne.getHostAddress());
            return;
        }
        System.out.println("Bound to " + bindAddressOne.getHostAddress());

        System.out.println("About to bind to " + 
                           bindAddressTwo.getHostAddress() + ":" + args[2]);

        serverSocketTwo.bind(socketAddressTwo);
        if (!serverSocketTwo.isBound()) {
            System.out.println("Couldn't bind to " + 
                                           bindAddressTwo.getHostAddress());
            return;
        }
        System.out.println("Bound to " + bindAddressTwo.getHostAddress());

        serverSocketOne.close();
        serverSocketTwo.close();
    }
    catch (ArrayIndexOutOfBoundsException exception) {
        System.out.println(
                  "IpBind <ip address one> <ip address two> " +
                  "<port number>");
    }
    catch (java.io.IOException ioException) {
        System.out.println("Error: " + ioException.getMessage());
    }
}

-----Original Message-----
From: Robert L Sowders [mailto:rsowders@usgs.gov]
Sent: Saturday, October 26, 2002 5:25 AM
To: Tomcat Users List
Subject: Re: Tomcat 4.1.12 taking IPs or Ports not assigned to it?


It's by design. 

Try using two nic's on different subnets.  Say 1.2.3.4 and 1.2.4.4.

rls

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message