Re: FTP server active / passive mode UPDATE

2010-12-02 Thread Niklas Gustavsson
On Thu, Dec 2, 2010 at 10:12 AM, Aidan Diffey wrote: > The problem has been fixed..  My code that was reading the database > was throwing a NullPointerException which was causing the stream close > problem. > > Also, moving the code from the FTPLet into a FileSystemView / Factory > and FTPFile app

Re: FTP server active / passive mode UPDATE

2010-12-02 Thread Aidan Diffey
Hello All. The problem has been fixed.. My code that was reading the database was throwing a NullPointerException which was causing the stream close problem. Also, moving the code from the FTPLet into a FileSystemView / Factory and FTPFile appears to have solved the Data Connection Issue. Thank

Re: FTP server active / passive mode UPDATE

2010-11-30 Thread Aidan Diffey
Hello. That is interesting. When I change the createOutputStream method to the following it appears to work and doesn't throw the exception. private static byte[] staticBytes = "I am a static byte string".getBytes(); /** * * @param offset * @return * @throws IOExcep

Re: FTP server active / passive mode UPDATE

2010-11-29 Thread Niklas Gustavsson
> I have a single FTPLet coded that uses the beforeCommand and afterCommand. > The afterCommand on PASS sets the client IP address and the > MessageEndpointFactory. > > > When the NIOListener receives an RETR (from the server on any of the Virtual > IP addresses), it goes through the normal RETR cl

Re: FTP server active / passive mode UPDATE

2010-11-29 Thread Aidan Diffey
On 29/11/2010 16:42, Niklas Gustavsson wrote: On Mon, Nov 29, 2010 at 12:50 PM, Aidan Diffey wrote: I have taken John's advise and implemented my own FTPFileSystemFactory, View and file. I have implemented my FtpFile createInputStream to read the data from the database and return a new ByteArr

Re: FTP server active / passive mode UPDATE

2010-11-29 Thread Aidan Diffey
On 29/11/2010 16:42, Niklas Gustavsson wrote: On Mon, Nov 29, 2010 at 12:50 PM, Aidan Diffey wrote: I have taken John's advise and implemented my own FTPFileSystemFactory, View and file. I have implemented my FtpFile createInputStream to read the data from the database and return a new ByteArr

Re: FTP server active / passive mode UPDATE

2010-11-29 Thread Niklas Gustavsson
On Mon, Nov 29, 2010 at 12:50 PM, Aidan Diffey wrote: > I have taken John's advise and implemented my own > FTPFileSystemFactory, View and file. > > I have implemented my FtpFile createInputStream to read the data from > the database and return a new ByteArrayOutputStream containing the > byte[] d

Re: FTP server active / passive mode UPDATE

2010-11-29 Thread Aidan Diffey
Hello All (Niklas, John). Firstly I would like to thank you for your ongoing help. I have taken John's advise and implemented my own FTPFileSystemFactory, View and file. I have implemented my FtpFile createInputStream to read the data from the database and return a new ByteArrayOutputStream con

Re: FTP server active / passive mode

2010-11-26 Thread John Hartnup
On 26 November 2010 14:14, Aidan Diffey wrote: > Could I do it in the afterCommand on the PASS command? > > Seems like a good option. -- "There is no way to peace; peace is the way"

Re: FTP server active / passive mode

2010-11-26 Thread Aidan Diffey
Could I do it in the afterCommand on the PASS command? On 26 November 2010 14:10, John Hartnup wrote: > On 26 November 2010 14:07, Aidan Diffey wrote: > >> Right. >> >> Given that a FileSystemView is created against an FTP session..  Can I >> get the Session from a FileSystemView.  My implementa

Re: FTP server active / passive mode

2010-11-26 Thread John Hartnup
On 26 November 2010 14:07, Aidan Diffey wrote: > Right. > > Given that a FileSystemView is created against an FTP session.. Can I > get the Session from a FileSystemView. My implementation requires me > to be able to get the IP address of the client that is performing the > RETR. > > One possib

Re: FTP server active / passive mode

2010-11-26 Thread Aidan Diffey
Right. Given that a FileSystemView is created against an FTP session.. Can I get the Session from a FileSystemView. My implementation requires me to be able to get the IP address of the client that is performing the RETR. Regards On 25 November 2010 11:32, John Hartnup wrote: > On 25 November

Re: FTP server active / passive mode

2010-11-25 Thread Aidan Diffey
So When my FTP client (Apache commons net FTP) connects and issues a RETR, it first issues a PASV command. My serer receives this, and is processed by the PASV java class in Apache FTP Server. My FTPLet runs the onDownloadStart() which looks up the DataConnectionFactory from the FTPSession and a

Re: FTP server active / passive mode

2010-11-25 Thread Niklas Gustavsson
On Thu, Nov 25, 2010 at 2:16 PM, John Hartnup wrote: > I hope I'm not offending anyone when I say that the documentation for those > extending the server is a little light. As the person that wrote most of the documentation I can only agree :-/ > There ought to be a similar statement about virtu

Re: FTP server active / passive mode

2010-11-25 Thread Aidan Diffey
I am only keen to carry on with the way that I am going as it is not a trivial change to implement the suggested classes, and I only see this problem happening on a Unix client and Windows server scenario. Cheers for the input. I will consider the suggested way of implementation. On 25 November 2

Re: FTP server active / passive mode

2010-11-25 Thread John Hartnup
On 25 November 2010 13:04, Aidan Diffey wrote: > I have been doing that with the documentation provided by the Apache > FTP server. (https://mina.apache.org/ftpserver/ftplet.html). I am > sending FTP reply codes at every stage. I have looked at the RETR > command and looks like I am sending the

Re: FTP server active / passive mode

2010-11-25 Thread Aidan Diffey
I have been doing that with the documentation provided by the Apache FTP server. (https://mina.apache.org/ftpserver/ftplet.html). I am sending FTP reply codes at every stage. I have looked at the RETR command and looks like I am sending the same codes On 25 November 2010 12:56, John Hartnup wrot

Re: FTP server active / passive mode

2010-11-25 Thread John Hartnup
On 25 November 2010 11:55, Aidan Diffey wrote: > From what I can see, the DefaultFTPLet code does nothing on the > onDownloadStart() command. This returns null which causes the default > execute in the RETR class to be called. > > I am returning FtpletResult.SKIP which causes the default RETR com

Re: FTP server active / passive mode

2010-11-25 Thread Aidan Diffey
>From what I can see, the DefaultFTPLet code does nothing on the onDownloadStart() command. This returns null which causes the default execute in the RETR class to be called. I am returning FtpletResult.SKIP which causes the default RETR command to NOT be executed. So I think I am okay doing impl

Re: FTP server active / passive mode

2010-11-25 Thread John Hartnup
On 25 November 2010 11:18, Aidan Diffey wrote: > I have embedded the FTP server into a JBoss application. When the > client issues a RETR command, I read a database and get a byte[] which > I the transfer to the client. > > How can I transfer the data to the client with the onDownloadStart > meth

Re: FTP server active / passive mode

2010-11-25 Thread Aidan Diffey
I have embedded the FTP server into a JBoss application. When the client issues a RETR command, I read a database and get a byte[] which I the transfer to the client. How can I transfer the data to the client with the onDownloadStart method without opening / closing data connections? Regards On

Re: FTP server active / passive mode

2010-11-25 Thread John Hartnup
On 25 November 2010 10:49, Aidan Diffey wrote: > Okay.. Now I am stumped. > > How do I create a custom FTPLet that implements the onDownloadStart > method in PASSIVE mode? > > Reading both your posts, I think you're confused about what onDownloadStart() does. As far as I understand, when a RETR

Re: FTP server active / passive mode

2010-11-25 Thread Aidan Diffey
Okay.. Now I am stumped. How do I create a custom FTPLet that implements the onDownloadStart method in PASSIVE mode? Regards On 25 November 2010 09:30, Aidan Diffey wrote: > Hello. > > I am trying to establish why I cannot open a data connection when a > embedded FTP client is trying to esta

FTP server active / passive mode

2010-11-25 Thread Aidan Diffey
Hello. I am trying to establish why I cannot open a data connection when a embedded FTP client is trying to establish a data connection to my FTP server. The embedded client is Apache Commons.NET FTPSClient running on a Unix environment. The FTP server is running on a windows machine. When the F