You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-dev@incubator.apache.org by Mike Greene <gr...@gmail.com> on 2006/03/30 17:04:55 UTC
onUploadStart
I created my ftplet and can't get it to work with windows command line ftp
or ncftp. The Stream never reads data it just
hangs. However if i use filezilla I enter the while loop and do not time
out. I am stuck and dont know what to do.
//stripped down example
public FtpletEnum onUploadStart(FtpRequest request, FtpResponse response)
throws FtpException, IOException {
InputStream is = request.getDataInputStream();
while (is.read() > 0) { //command line hangs
System.out.println( "read Data");
}
return FtpletEnum.RET_SKIP;
}
Re: onUploadStart
Posted by Rana Bhattacharyya <ra...@yahoo.com>.
Hi,
You need to do two extra things.
1. The server has to notify that it is ready to
receive data by sending response 150 before getting
the stream. Unless client receives 150, it will not
send any data.
2. If everything is fine, the server should send 226
response to client.
So the code block should look like:
public FtpletEnum onUploadStart(FtpRequest request,
FtpResponse response) throws FtpException, IOException
{
response.write(150, "STOR");
InputStream is = request.getDataInputStream();
while (is.read() > 0) { //command line hangs
System.out.println( "read Data");
}
response.write(226, "STOR");
return FtpletEnum.RET_SKIP;
}
Thanks,
Rana Bhattacharyya
--- Mike Greene <gr...@gmail.com> wrote:
> I created my ftplet and can't get it to work with
> windows command line ftp
> or ncftp. The Stream never reads data it just
> hangs. However if i use filezilla I enter the
> while loop and do not time
> out. I am stuck and dont know what to do.
>
>
> //stripped down example
> public FtpletEnum onUploadStart(FtpRequest request,
> FtpResponse response)
> throws FtpException, IOException {
> InputStream is =
> request.getDataInputStream();
>
> while (is.read() > 0) { //command line hangs
> System.out.println( "read Data");
> }
>
> return FtpletEnum.RET_SKIP;
> }
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com