0

I have a serious issue on my FTPClient which works well over landline but when I try to use the same implementation over my Android Wireless Device my connection just stucks.

I have deployed my code on an Android Application and the result is bad. Sometimes I can download my files and sometimes I get only to 40 % and the connection times out with a java.net.SocketTimoutException. I have the exception here:

05-27 19:37:49.390: DEBUG/SntpClient(1290): request time failed: java.net.SocketTimeoutException: Connection timed out

05-27 19:32:55.417: WARN/System.err(5129): java.net.SocketTimeoutException
05-27 19:32:55.467: WARN/System.err(5129):     at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:564)
05-27 19:32:55.467: WARN/System.err(5129):     at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:88)
05-27 19:32:55.467: WARN/System.err(5129):     at java.io.InputStreamReader.read(InputStreamReader.java:275)
05-27 19:32:55.467: WARN/System.err(5129):     at java.io.BufferedReader.fillBuf(BufferedReader.java:155)
05-27 19:32:55.467: WARN/System.err(5129):     at java.io.BufferedReader.read(BufferedReader.java:261)
05-27 19:32:55.467: WARN/System.err(5129):     at org.apache.commons.net.io.CRLFLineReader.readLine(CRLFLineReader.java:58)
05-27 19:32:55.467: WARN/System.err(5129):     at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:310)
05-27 19:32:55.467: WARN/System.err(5129):     at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:290)
05-27 19:32:55.467: WARN/System.err(5129):     at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:479)
05-27 19:32:55.467: WARN/System.err(5129):     at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:552)
05-27 19:32:55.467: WARN/System.err(5129):     at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:601)
05-27 19:32:55.475: WARN/System.err(5129):     at org.apache.commons.net.ftp.FTP.abor(FTP.java:754)
05-27 19:32:55.475: WARN/System.err(5129):     at org.apache.commons.net.ftp.FTPClient.abort(FTPClient.java:2432)
05-27 19:32:55.475: WARN/System.err(5129):     at src.app.asyncTasks.ftp.DownloadFTPFilesTask$2.onClick(DownloadFTPFilesTask.java:186)
05-27 19:32:55.475: WARN/System.err(5129):     at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:158)
05-27 19:32:55.475: WARN/System.err(5129):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-27 19:32:55.475: WARN/System.err(5129):     at android.os.Looper.loop(Looper.java:143)
05-27 19:32:55.475: WARN/System.err(5129):     at android.app.ActivityThread.main(ActivityThread.java:4717)
05-27 19:32:55.483: WARN/System.err(5129):     at java.lang.reflect.Method.invokeNative(Native Method)
05-27 19:32:55.483: WARN/System.err(5129):     at java.lang.reflect.Method.invoke(Method.java:521)
05-27 19:32:55.491: WARN/System.err(5129):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
05-27 19:32:55.491: WARN/System.err(5129):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
05-27 19:32:55.491: WARN/System.err(5129):     at dalvik.system.NativeStart.main(Native Method)
05-27 19:32:55.522: WARN/InputManagerService(1290): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@45a93758

I just cannot find the reason for this. The server just seems to stop responding. Is there any option I can set? I already tried SOTimeout, but I seems to be more like a overflow or something. The File Download stops anywhere but I does not finish.

Edit:

I am connecting to an Acitve FTP Server using apache commons. Maybe the ServerSocket crashes or just times out... ? I was playing with the thought to implement my own server factory but have no idea how, yet. I am using Android 2.1 on a Motorola Milestone.

Optimus
  • 15
  • 1
  • 8
  • Welcome to the wonderful world of FTP, [this](http://stackoverflow.com/questions/8661239/is-ftp-reliable-for-use-with-an-automated-data-exchange-application) might be of interest. – home May 27 '12 at 17:56
  • Thanks you but this does not seem to refer to my problem. – Optimus May 27 '12 at 18:21
  • Agreed, the point is that you can't rely on network reliability. FTP might just be the wrong solution... – home May 27 '12 at 18:54
  • I believe FTP is reliable, if you stay strict to the protocol. – Optimus May 27 '12 at 22:30
  • Hm, perhaps wireshark is your last resort - if you can reproduce the problem over your WiFi. Or does it only occur in 3G situations? – home May 28 '12 at 05:39
  • It happens while I am connected via Wifi. The point is that I believe this is a socket Problem. The source of my assumption is the following: 05-28 16:44:29.093: WARN/System.err(3893): java.net.SocketTimeoutException 05-28 16:44:29.093: WARN/System.err(3893): at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:564) – Optimus May 28 '12 at 15:18

0 Answers0