cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: FTP passive mode

From: Patrick Monnerat <Patrick.Monnerat_at_datasphere.ch>
Date: Wed, 26 Oct 2011 13:40:11 +0200

Oleksiy wrote:

> So I just need to include in code something like

> curl_easy_setopt(curlhandle, CURLOPT_FTPPORT, "-");

> to connect to FTP in active mode, and that's all, yes?

At the libcurl logic point of view: yes.

But depending on what you want to achieve and/or your client systems
configuration, you may need some more "refined" ftp port parameter.

Be also aware that, in active mode, the server connects to the client:
this means you may have problems along the network path with:

- Firewalls (reverse data port must be open).
- NAT (the real IP address of your client may not be seen as such by the
server).
- Port forwarding: inbound data connection requests should be redirected
to your client if the later is on a LAN and the server in the "outside"
world.

That's why the active mode is pretty much deprecated nowadays.

Of course, if the client and server are on the same LAN without
firewall(s) between them, this will work easily.

I suggest you try it first using the command line tool with something
like:

curl --verbose --ftp-port - ... ftp://your_url/xxxx

Patrick

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-10-26