ftp LIST in C
From: zhisol (zhisol@o2.pl)
Date: 04/24/03
- Next message: Dragan Cvetkovic: "Re: ftp LIST in C"
- Previous message: David Schwartz: "Re: max. amount of memory I can allocate using "new""
- Next in thread: Dragan Cvetkovic: "Re: ftp LIST in C"
- Reply: Dragan Cvetkovic: "Re: ftp LIST in C"
- Reply: scriptOmatic: "Re: ftp LIST in C"
- Reply: Adie: "Re: ftp LIST in C"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "zhisol" <zhisol@o2.pl> Date: Thu, 24 Apr 2003 20:32:04 +0200
I've stated writing simple application for linux that list directory of
ftp server. I plan list subdirectories, too. But now, i have a PROBLEM.
I use sockets.
Connecting is simple, after assigni used only:
sd=socket(...) //sd-socket descriptor
connect(sd,...)
for USER, PASS, TYPE A, PASV, PWD i used:
send(sd,"USER\r\n",...)
recv(sd,...)
[...]
and everything was OK, but with LIST... here i have BIG problem.
How can i receive data from ftp? Loop with recv() do nothing :(
I suppose that list return data and require new port open on client, but
i don't know how can i know which port number? For connection to ftp i
open port 21 and that's ok, but what know, I jammed :(.
Could You help me?
#cut of my code:
[...]
send(sd,"LIST\r\n", strlen("LIST") + 2, 0);
n = recv (sd, buf, sizeof (buf), 0); //sd-socket descriptor
while (n > 0)
{
buf[n] = '\0';
printf ("%s", buf);
n = recv (sd, buf, sizeof (buf), 0);
}
PS:sorry for my english;)
-- pozdr.;) zhisol
- Next message: Dragan Cvetkovic: "Re: ftp LIST in C"
- Previous message: David Schwartz: "Re: max. amount of memory I can allocate using "new""
- Next in thread: Dragan Cvetkovic: "Re: ftp LIST in C"
- Reply: Dragan Cvetkovic: "Re: ftp LIST in C"
- Reply: scriptOmatic: "Re: ftp LIST in C"
- Reply: Adie: "Re: ftp LIST in C"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|