[android-developers] Re: nsftools

2008-12-23 Thread tonyant

Hi, I also work on the ftp uploading, and Use Jakarta commons FTP.
but I always meet exception
the code is:

FTPClient ftpClient = new FTPClient();
ftpClient.connect(InetAddress.getByName(server));
ftpClient.login(user, password);
Log.d("FTP",ftpClient.getReplyString());
ftpClient.changeWorkingDirectory(serverRoad);
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
BufferedInputStream buffIn=null;
buffIn=new BufferedInputStream(new FileInputStream(fileRoad));
ftpClient.storeFile(newFileName, buffIn);
buffIn.close();
ftpClient.logout();
ftpClient.disconnect();

I can find it is connected from log ,but when run
ftpClient.storeFile(newFileName, buffIn);

throw the exception,
  12-24 12:40:04.984: WARN/System.err(929):
org.apache.commons.net.ftp.FTPConnectionClosedException: Connection
closed without indication.

Could you help me ? thank you vey much


On Nov 3, 9:01 am, petunio  wrote:
> Hi Everybody
>
> I am writing an application that involves using a server for
> uploading / downloading data...
>
> I am using the Jakarta Commons FTP, well, to be more precise, a
> wrapper around it, found at:www.nsftools.com
>
> well, my question is that my code used to work with the android sdk
> version 3, but now that I am upgrading it to the new sdk, the
> connectAndLogin function doesn't work, this is, it does not connect to
> the host ( I am sure that the host, the name and the password are
> correct)
>
> this is the function:
>
>         public boolean connectAndLogin (String host, String userName, String
> password)
>                         throws  IOException, UnknownHostException,
> FTPConnectionClosedException
>         {
>
>                 boolean success = false;
>
>                 connect(host);
>
>                 int reply = getReplyCode();
>
>                 if (FTPReply.isPositiveCompletion(reply))
>                         success = login(userName, password);
>                 if (!success)
>                         disconnect();
>
>                 return success;
>
>         }
>
> when it calls connect(host), I can see at the adb logcat the following
> message:
> "OSNetworkS unknown socket error -1"
>
> has anybody come along this problem?
>
> Thanks a lot!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: nsftools

2008-12-23 Thread tonyant

Hi,

when I use Jakarta CommonsFTP,
  In the code ftpClient.listFiles("files") or ftpClient.storeFile();
  get the error:
org.apache.commons.net.ftp.FTPConnectionClosedException:
Connection closed without indication.

Did you meet such thing?



On Nov 3, 9:01 am, petunio  wrote:
> Hi Everybody
>
> I am writing an application that involves using a server for
> uploading / downloading data...
>
> I am using the Jakarta CommonsFTP, well, to be more precise, a
> wrapper around it, found at:www.nsftools.com
>
> well, my question is that my code used to work with the android sdk
> version 3, but now that I am upgrading it to the new sdk, the
> connectAndLogin function doesn't work, this is, it does not connect to
> the host ( I am sure that the host, the name and the password are
> correct)
>
> this is the function:
>
>         public boolean connectAndLogin (String host, String userName, String
> password)
>                         throws  IOException, UnknownHostException,
> FTPConnectionClosedException
>         {
>
>                 boolean success = false;
>
>                 connect(host);
>
>                 int reply = getReplyCode();
>
>                 if (FTPReply.isPositiveCompletion(reply))
>                         success = login(userName, password);
>                 if (!success)
>                         disconnect();
>
>                 return success;
>
>         }
>
> when it calls connect(host), I can see at the adb logcat the following
> message:
> "OSNetworkS unknown socket error -1"
>
> has anybody come along this problem?
>
> Thanks a lot!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: nsftools

2008-11-02 Thread petunio

Hey man!

Thanks a lot! it works

you saved me a lot of time, now I can go to sleep...

Thanks again



On Nov 3, 1:06 am, Mark Murphy <[EMAIL PROTECTED]> wrote:
> petunio wrote:
> > Hi Everybody
>
> > I am writing an application that involves using a server for
> > uploading / downloading data...
>
> > I am using the Jakarta Commons FTP, well, to be more precise, a
> > wrapper around it, found at:
> >www.nsftools.com
>
> > well, my question is that my code used to work with the android sdk
> > version 3, but now that I am upgrading it to the new sdk, the
> > connectAndLogin function doesn't work, this is, it does not connect to
> > the host ( I am sure that the host, the name and the password are
> > correct)
>
> > this is the function:
>
> >    public boolean connectAndLogin (String host, String userName, String
> > password)
> >                    throws  IOException, UnknownHostException,
> > FTPConnectionClosedException
> >    {
>
> >            boolean success = false;
>
> >            connect(host);
>
> >            int reply = getReplyCode();
>
> >            if (FTPReply.isPositiveCompletion(reply))
> >                    success = login(userName, password);
> >            if (!success)
> >                    disconnect();
>
> >            return success;
>
> >    }
>
> > when it calls connect(host), I can see at the adb logcat the following
> > message:
> > "OSNetworkS unknown socket error -1"
>
> > has anybody come along this problem?
>
> "unknown socket error -1" frequently comes from missing the INTERNET
> permission in your AndroidManifest.xml.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
>
> Android Training on the Ranch! -- Mar 16-20, 
> 2009http://www.bignerdranch.com/schedule.shtml
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: nsftools

2008-11-02 Thread Mark Murphy

petunio wrote:
> Hi Everybody
> 
> I am writing an application that involves using a server for
> uploading / downloading data...
> 
> I am using the Jakarta Commons FTP, well, to be more precise, a
> wrapper around it, found at:
> www.nsftools.com
> 
> well, my question is that my code used to work with the android sdk
> version 3, but now that I am upgrading it to the new sdk, the
> connectAndLogin function doesn't work, this is, it does not connect to
> the host ( I am sure that the host, the name and the password are
> correct)
> 
> this is the function:
> 
>   public boolean connectAndLogin (String host, String userName, String
> password)
>   throws  IOException, UnknownHostException,
> FTPConnectionClosedException
>   {
> 
>   boolean success = false;
> 
>   connect(host);
> 
>   int reply = getReplyCode();
> 
>   if (FTPReply.isPositiveCompletion(reply))
>   success = login(userName, password);
>   if (!success)
>   disconnect();
> 
>   return success;
> 
>   }
> 
> when it calls connect(host), I can see at the adb logcat the following
> message:
> "OSNetworkS unknown socket error -1"
> 
> has anybody come along this problem?

"unknown socket error -1" frequently comes from missing the INTERNET 
permission in your AndroidManifest.xml.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com

Android Training on the Ranch! -- Mar 16-20, 2009
http://www.bignerdranch.com/schedule.shtml

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---