FTP: I Can only download and upload within WiFi Range

Mahares

Expert
Licensed User
Longtime User
I can upload and download files from a PC server (not a web server) running FTP when I am within WiFi range, but nothing happens if I am outside the range or doing the transfer from a remote location. I am using a real device. Is that the way FTP is supposed to work? I am puzzled.
Thank you.
 

warwound

Expert
Licensed User
Longtime User
Let's get this clear...

Your computer runs an FTP server and you can only connect to it via WiFi as the IP address you are connecting to is valid on the local network only?
If you try to connect to that local network IP address via the internet it obviously fails.

Solution:

Get a free Dyn account.
Then setup a domain name for your home computer.

This works much like having a 'normal' domain name mapped to an IP address but the Dyn domain name that you create is mapped to your home computer's dynamic IP address.

You then need to keep the Dyn server up to date with your current dynamic IP address.

  • You can install a client on your home computer that keeps the Dyn server informed of your current dynamic IP address.
  • If your router has a built in dynamic DNS client you can configure your router to keep the Dyn server informed of your current dynamic IP address.
    This is the better option if your router supports it, there is no need to install a client on your computer and the Dyn server is always kept up to date with your current dynamic IP address even if your computer is switched off.
    Does the D-Link DI-614+ have a built in dynamic DNS client?

So you now have a Dyn domain name that can be used to connect to your home computer instead of using a local network IP address.

Update your B4A project to use this Dyn domain name instead of the local network IP address.

Martin.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Martin: Thank you for the thorough instructions. As with all the tips I was provided, I dug into them right away. Unfortunately, there is no Dyn free version, only trial versions. Like many web sites you explore, you get bombarded by buttons where it becomes hard to know which one applies to your needs. I was hoping TheDesoluteSoul solution will deliver for me. I can see why people get discouraged and settle for using email to send and receive files. I appreciate all the tips from all the forum users provided me on this thread. Sometimes the best things in life are the simple ones.
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
That's strange!
I have a free Dyn account that works fine and has worked fine for years.

I did wonder whether they no longer make free accounts available but continue to support existing free accounts such as mine...
I googled and found this:

From Dyn: What happened to Free Accounts - Dyn Community Forum

All is not lost though - there's more than one fish in the ocean...

No-IP™ Free - Free Dynamic DNS - DDNS

I used noip.com before moving to Dyn and had no problems with them.
The only reason i moved to Dyn was because my router has a built in client for use with Dyn but it wouldn't work with noip.com.

So you'll probably need a noip.com client running on your computer to keep your dynamic IP address synchronised with your noip.com domain.

But have a google.
A lot of routers have 3rd party custom firmware available and you might even find a custom firmware for your router that supports a free service such as noip.com.

Martin.
 
Upvote 0

alf

New Member
Licensed User
Longtime User
Mahares I have the same problem as you and there is no need to create another thread if the problem is the same and the answer may be valid for both.

Warwound: I repeat the question

I'm trying to access an FTP server that is in my work with a public IP and can access it via internet by pc or by Android (AndFTP) for example.

The problem is when I try to access it through my program Basic4android done, you can only access the server with WIFI not 3G. But with the AndFTP or another ftp client, I can access the server by Wi-Fi or 3G.

To access the server I'm using the public IP 213.98.xxx.xxx not a DNS name.

Thanks.
 
Upvote 0

flyingpole

Member
Licensed User
Longtime User
Same issue Here

I have the same issue. I have an ftp account on Drivehq.com. I am trying to have my B4A application access files on that ftp server. When I am connected to the internet via my home wifi, the application works flawlessly. When I switch to cellular mode (3g/4g on my Xoom tablet), the file transfer (download in this case) times out every time. I try and access the drivehq ftp server via ANDFTP, and it immedialtely connects over 3G/4G connection.

Help on this would be greatly appreciated.

******** UPdate ********
I got it to work. I had to enable passive mode. Gosh, that was simple
 
Last edited:
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Okay FTP Lovers,
I think you should have read the FTP specs more closely before using it.

Active Mode FTP:
Will not work over mobile networks mainly because incoming connections are blocked. Active Mode FTP requires the client to connect to a control port (21) and then the server responds over another port. Since on 3G etc you cannot accept an incoming connection this will always fail.

Passive Mode FTP:
Here the client is responsible for opening the data port as well, therefore with the connection initiated at the mobile device, the mobile network will let this through.

This is a general disadvantage of all NAT based networks, not just restricted to mobile networks.
Solution: You must use passive mode.
 
Upvote 0

cirollo

Active Member
Licensed User
Longtime User
Same Problem!

I have the same problem, I'm trying to upload a txt file to a ftp server that uses active mode

the problem is that sometimes I get the upload, sometimes no files is transferred.
Is possible to use active mode? I cannot change it because my provider doesn't permit!!!
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
I have the same problem, I'm trying to upload a txt file to a ftp server that uses active mode

the problem is that sometimes I get the upload, sometimes no files is transferred.
Is possible to use active mode? I cannot change it because my provider doesn't permit!!!

On a cellular network that does not allow incoming connections, you cannot use active mode.
 
Upvote 0

latch

Active Member
Licensed User
Longtime User
Ok so the silly question I have is, "Do I change it to passive mode in my code or is that some setting with my webhost?"
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
You have limited or no options!

You need an FTP server that supports passive mode or a reliable method to connect to an FTP server in active mode.
You have neither, an FTP server that doesn't support passive mode is little use in any mobile app because so many telecom providers block such connections.

Martin.
 
Upvote 0

latch

Active Member
Licensed User
Longtime User
You have limited or no options!

You need an FTP server that supports passive mode or a reliable method to connect to an FTP server in active mode.
You have neither, an FTP server that doesn't support passive mode is little use in any mobile app because so many telecom providers block such connections.

Martin.

Yeah, I was being ironic. It is pure joy it takes only one line of code to fix it.
 
Upvote 0
Top