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 Satish Kaveti <Sa...@sick.com> on 2010/01/06 22:42:56 UTC

FtpServer : Delay in sending 226 - Transfer complete response

I have a FtpServer application in which images to transferred from the 
client. The client is sending roughly 3 images per second. Each image is 
roughly 300 kbytes long. For some reason the server is not able to keep up 
with the incoming images. Looking at the sniffer output, it seems that 
there  is a delay of roughly 200 ms in sending '226 - Transfer complete' 
reply after completing the image transfer.

Do I need to enable / disable TCP_NODELAY ? If so, how do I enable / 
disable TCP_NODELAY.

I am using FtpServer 1.0.0.

Thanks

Satish Kaveti
Software Engineer

--------------------------------------------------------
SICK, Inc.
Automatic Identification Solutions
--------------------------------------------------------
800 Technology Center Drive 
Suite 6
Stoughton, MA  02072 USA 
Direct: 781.302.2525
Phone: 781.302.2500
Fax: 781.828.3150
http://www.sickusa.com

Re: FtpServer : Delay in sending 226 - Transfer complete response

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Wed, Jan 6, 2010 at 10:42 PM, Satish Kaveti <Sa...@sick.com> wrote:
> I have a FtpServer application in which images to transferred from the
> client. The client is sending roughly 3 images per second. Each image is
> roughly 300 kbytes long. For some reason the server is not able to keep up
> with the incoming images. Looking at the sniffer output, it seems that
> there  is a delay of roughly 200 ms in sending '226 - Transfer complete'
> reply after completing the image transfer.

I think we need some more details. What do you mean by the client
sending 3 images per second? A session in FtpServer is
"single-threaded" in that a file transfer will block the control
socket. Thus, you can not send more than the server can handle.

The delay your seeing, how do you detect it?

What OS are you on? What JVM version?

> Do I need to enable / disable TCP_NODELAY ? If so, how do I enable /
> disable TCP_NODELAY.

We do not currently provide a configuration for it, But, you can patch
the source code yourself. Please let us know the results.

Index: src/main/java/org/apache/ftpserver/listener/nio/NioListener.java
===================================================================
--- src/main/java/org/apache/ftpserver/listener/nio/NioListener.java	(revision
835894)
+++ src/main/java/org/apache/ftpserver/listener/nio/NioListener.java	(working
copy)
@@ -136,7 +136,8 @@
             // Decrease the default receiver buffer size
             ((SocketSessionConfig) acceptor.getSessionConfig())
                     .setReceiveBufferSize(512);
-
+            acceptor.getSessionConfig().setTcpNoDelay(true);
+
             MdcInjectionFilter mdcFilter = new MdcInjectionFilter();

             acceptor.getFilterChain().addLast("mdcFilter", mdcFilter);

/niklas