[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

implimenting c with rfc959




Hi,
I'm trying to write a simple c app to fetch files with ftp protocol,
basicly it get few args (host,dir,file). as i understand from rfc959 there
2 way to retrive files using the ftp protocol a) PASV b) PORT
my problem is that i don't know how to implement the PASV approche,
i.e if i have something like 
---
 strcpy ( tmp, "PASV"); strcat ( tmp, "\n");
  write ( sd, tmp, strlen(tmp)); bzero ( &tmp, sizeof(tmp));
  read ( sd, netbuf, sizeof(netbuf));
  printf ( "%s", netbuf); bzero ( &netbuf, sizeof(netbuf));
---
i need to get the data resived at netbuf witch is:
227 Entering Passive Mode (b1,b2,b3,b4,b5,b6), where b1-4 is the IP
and b5-6 is the port, so i can connect to b1-4 at port b5 * 256 + b6 and
retrive a desired file.

how can i manipulate netbuf to calculate b5 * 256 + b6 ?


Thank's
Guy.

-- 
Guy Cohen <guy@spice.org.il>