You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-users@mina.apache.org by Ma...@tieto.com on 2010/09/06 14:16:16 UTC

Multiple listeners allowed on same port

Hi,

I have a very similar issue as http://www.mail-archive.com/ftpserver-users@mina.apache.org/msg01206.html

It seems it's possible to start more than one listener on the same port, I didn't think windows allowed this...

Below snippet is from netstat:
----
Active Connections

  Proto  Local Address          Foreign Address        State           PID
  TCP    0.0.0.0:21             0.0.0.0:0              LISTENING       8084
  TCP    0.0.0.0:21             0.0.0.0:0              LISTENING       6024
----

Using:
Ftpserver 1.0.4
Windows XP SP3
Jre1.5 and jre 1.6, gives the same result.

Is there any known way to only allow one listener per port?

Thanks in advance
/Magnus


Re: Multiple listeners allowed on same port

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Mon, Sep 6, 2010 at 2:16 PM,  <Ma...@tieto.com> wrote:
> Is there any known way to only allow one listener per port?

Could you please try a patch in your environment to see if this fixes
your issue?

Index: src/main/java/org/apache/ftpserver/listener/nio/NioListener.java
===================================================================
--- src/main/java/org/apache/ftpserver/listener/nio/NioListener.java	(revision
921711)
+++ src/main/java/org/apache/ftpserver/listener/nio/NioListener.java	(working
copy)
@@ -129,7 +129,7 @@
                 address = new InetSocketAddress(getPort());
             }

-            acceptor.setReuseAddress(true);
+            acceptor.setReuseAddress(false);
             acceptor.getSessionConfig().setReadBufferSize(2048);
             acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE,
                     getIdleTimeout());


If this patch does the trick, we will make this configurable in 1.1.0.

/niklas