cURL / Mailing Lists / curl-library / Single Mail


Re: 425 Can't open data connection

From: Dan Fandrich <>
Date: Tue, 11 Nov 2008 10:32:21 -0800

On Tue, Nov 11, 2008 at 08:27:58PM +0530, Buchibabu Chennupati wrote:
> I am new to curl and just playing around with sample examples given in the
> site.
> Using the following code I am trying to get a file magnum.xml at location /tmp/
> magnumfw using ftp.
> I am not sure what the problem is but I couldn't get the file. I am getting
> < 425 Can't open data connection.
> Please clarify me where I have missed.

> static const char cmd[] = "CWD /tmp/magnumfw";
> static const char cmd1[] = "PWD";
> static const char cmd2[] = "PASV";
> static const char cmd3[] = "TYPE A";
> static const char cmd4[] = "RETR magnum.xml";

You can't send all these commands as CURLOPT_QUOTE commands. Doing so really
messes with curl's idea of the state of the connection. The PASV command for
one needs client-side support to open a connection and transfer data which
doesn't happen when you send a QUOTE command. There's really no point
in using libcurl if you're doing this--if your app wants to send ftp
commands directly, then it ought to just open a socket to the ftp server
and do it all itself. The point of using libcurl is to avoid having to
deal with the low-level protocol stuff in the app.

When you supply a URL with the CURLOPT_URL parameter, libcurl will do all
those commands for you. Just give a proper URL (something like;type=A looks to be about what
you want) and libcurl will take care of the rest.

>>> Dan

--              The web change of address service
          Let webmasters know that your web site has moved
Received on 2008-11-11