[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: implimenting c with rfc959
On Sat, 17 Apr 1999, Guy Cohen wrote:
> 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 hope this is not the exact code you wrote, or that the process is not
interactive, since generally either the read or the write could block for
an unknown ammount of time...
> 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 imanipulate netbuf to calculate b5 * 256 + b6 ?
i'd assume using scanf on this buffer would allow you to parse its
contents. you could also use other methods to scan this buffer (strtok ,
scanning using strchr, etc.) but i think scanf would be your easiest
choice.
guy