It's it fttp:// and not ftp:// ?
On Jul 12, 1:25 pm, jonne <[email protected]> wrote:
> Dear developers,
>
> I'm searching for a way to store data files via FTP from my Android
> application.
> My approach is to create a Google Base account and upload/download
> files from my application there.
>
> To achieve this, I added the following permission to the manifest file
> <uses-permission android:name="android.permission.INTERNET"></uses-
> permission>
>
> And I used the below code.
> The problem with this code is I get an IOException "Unable to connect
> to server: {0}".
>
> Does anybody know how to fix that, or how to get the result of
> uploading/downloading/listing files in another way?
> Thanks,
> Jonne.
>
> try {
> Log.v(TAG, "Opening FTP connection.");
> URL url = new
> URL("ftp://userid:[email protected]/");
> // URL url = new
> URL("ftp://userid:[email protected]/");
> URLConnection urlc = url.openConnection();
> // urlc.setDoInput(true);
> // urlc.setDoOutput(true);
> urlc.connect();
>
> BufferedReader in = new BufferedReader(new
> InputStreamReader
> (urlc.getInputStream()));
> String line = in.readLine();
> while(line != null) {
> Log.v(TAG, "Line: " + line);
> line = in.readLine();
> }
> // InputStream is = urlc.getInputStream(); // To download
> // OutputStream os = urlc.getOutputStream(); // To upload
> } catch (MalformedURLException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---