1
votes

From a FTP server perspective, if a client requests a file through RETR command, the server creates a data connection (socket) to the client through the specified port and starts the transfer by writing in the outputstream. The server is coded (JAVA) in such a way that after the write is complete in the socket, the outputstream is flushed and then the socket is closed. After this the code "226" is sent to the client in control channel.

Since the connection is over a very slow network, the 226 message reaches before the actual data transfer is complete. This is a tricky situation where the client code cannot be changed and the server has to make sure that the 226 is sent after client received the data.

I tried searching in the internet and got few inputs, but not sure which one is the standard. 1. to use setSoLinger() method to turn on SO_LINGER and to set timeout. 2. to introduce a delay after writing each byte in to socket (performance will be impacted for fast connections).

Is there any other options other than the above to solve the situation. Any idea about the standard followed for sending 226 in Linux/ Solaris/Windows FTP Servers.

I could see a similar thread in stackoverflow "When should 226 be sent from the FTP server?" , but could not find much info from that related to my question.

Help here is really appreciated...Thanks

1
Using Linger is standard operation, adding delay is not professional way and may result to slow down the system.Heena Goyal
Why do you need an option other than the correct answer?user207421
@EJP - I am not getting it. Which one is the correct answer? Pls adviseuser2813978

1 Answers

1
votes

Do not go with the delay for sure, the only thing I can think of is that you build a proxy layer that intercepts the acknowledge code, checks for the file, and reroutes the code to the application, sort of what telerik fiddler does as an application.

The same concept I used before with the JMS acknowledge mode when delivering messages to the server and I had to implement the same.

Wish you all luck my friend