Fwd: PORT allocation explanation?

Neil Avery neil at liquidlabs.co.uk
Sun Jan 2 04:02:34 EST 2011


Bump - trustin would u have any ideas?

---------- Forwarded message ----------
From: Neil Avery <neil at liquidlabs.co.uk>
Date: Thursday, December 9, 2010
Subject: PORT allocation explanation?
To: Netty -Users List <netty-users at lists.jboss.org>


Hi,We have been using Netty with great success. One of the things we
have recently found that there seems to be a unexplainable number of
ports being opened. Ive hijacked the Echo Client and Server - the test
is below:
	@Test	public void shouldFireUpServerAndRunClient() throws Exception {

		System.out.println("PID:" +
ManagementFactory.getRuntimeMXBean().getName());		EchoServer.main(new
String[0]);
				EchoClient.main(new String[] { "localhost", "33333", "1024" });
	}
By the time the test is running and msgs pinging back and forth we
observe 7 opened ports which have no explanation (see observations
below). When swapping in OioServerSocketChannelFactory and
OioClientSocketChannelFactory we end up with 3 ports (2 for the JVM)
and 1 client-server connection.....which is what we would expect from
the Nio factorys.... is there a reason for the ports being allocated
or is it something that can be fixed in configuration?

Platform: Windows 7, Java 1.6_20 x86, Netty 3.2.3 Final
Regards Neil.
Nio observervations:
1. Start the TestCase (break before running EchoServer and netstat
shows the values below. I assume this is jconsole/jmx or something
associated with the JVM management.

  TCP    127.0.0.1:61013        envy14:61012           ESTABLISHED
10080  TCP    127.0.0.1:61014        envy14:61011
ESTABLISHED     10080


2. Step over EchoServer so that its sitting there waiting (on port
33333): - 2 more ports are opened....  TCP    127.0.0.1:61013
envy14:61012           ESTABLISHED     10080
  TCP    127.0.0.1:61014        envy14:61011           ESTABLISHED
10080  TCP    127.0.0.1:61016        envy14:61017
ESTABLISHED     10080
  TCP    127.0.0.1:61017        envy14:61016           ESTABLISHED     10080
3. Then let the EchoClient run and we observe the following....
  TCP    127.0.0.1:33333        envy14:61018           ESTABLISHED
10080  TCP    127.0.0.1:61013        envy14:61012
ESTABLISHED     10080
  TCP    127.0.0.1:61014        envy14:61011           ESTABLISHED
10080  TCP    127.0.0.1:61016        envy14:61017
ESTABLISHED     10080
  TCP    127.0.0.1:61017        envy14:61016           ESTABLISHED
10080  TCP    127.0.0.1:61018        envy14:33333
ESTABLISHED     10080
  TCP    127.0.0.1:61021        envy14:61022           ESTABLISHED
10080  TCP    127.0.0.1:61022        envy14:61021
ESTABLISHED     10080
  TCP    127.0.0.1:61023        envy14:61024           ESTABLISHED
10080  TCP    127.0.0.1:61024        envy14:61023
ESTABLISHED     10080


The same test with Oio - port allocation is:  TCP    127.0.0.1:33333
     envy14:61040           ESTABLISHED     3236
  TCP    127.0.0.1:61039        envy14:61038           ESTABLISHED
3236  TCP    127.0.0.1:61040        envy14:33333           ESTABLISHED
    3236






-- 

www.liquidlabs.co.uk



More information about the netty-users mailing list