Page 1 of 1

Plugin connection problem

Posted: 2012-06-02, 16:26 UTC
by test01
Hello.
I have installed FTP, WebDav and Lan plugins and all of them display an error, if I try to konnect somewhere with 3g and WiFi turned off. Even to localhost (I set up a local ftp-server).
With active WiFi or 3g it works normally.
Self-connecting through ftp may be useless, but it refuses to work if internet-connection is shared from PC by usb too. And this feature is not so useless.
So the question is: [how] can this checking of 3g/WiFi connectivity be turned off?
Thanks.

Posted: 2012-06-03, 13:54 UTC
by ghisler(Author)
FTP and WebDAV should work also over other connections than Wifi and phone connections if there are any - I don't know whether you can connect to localhost when there is no Internet at all. You need to allow non-wiFi connections in the settings of the LAN plugin.
it refuses to work if internet-connection is shared from PC by usb too
How do you do that?

Posted: 2012-06-04, 09:27 UTC
by test01
allow non-wiFi connections in the settings
Oh, I didn't know plugins have settings. Now webDav and Lan aren't asking for turning on WiFi or 3g but FTP steel does (havn't found any options for it).
How do you do that?
connect phone to PC as usb-modem, correct routes on PC and android and set 8.8.8.8 as DNS (on android).
Opera works correctly with my settings.

Posted: 2012-06-04, 15:31 UTC
by ghisler(Author)
Indeed the FTP client needs an internet connection to work. Here is what I use:

Code: Select all

		NetworkInfo ni;
		try { 
			ConnectivityManager cm=(ConnectivityManager)service.getSystemService(Context.CONNECTIVITY_SERVICE);
			ni=cm.getActiveNetworkInfo();
			connected=ni!=null;
			for (int i=0;i<=9;i++)
				if (!connected) {
					ni=cm.getNetworkInfo(i);
					connected=ni!=null && ni.isConnected();
				}
		} catch (Exception e) {
			ni=null;
		}
		if (!connected) {
			errorMsg(s_NoInternet, false);
			return FTP_GETSOCKNAMEFAILED;
		}
Otherwise the call to connect would hang...