Using the FTPS Package
Example 15 – Retrieving a Document Securely via FTPS
This example establishes a secure connection and then retrieves a document from the server using the RETR command.
RWWinSockInfo winsock; //1
RWSecureSocketPackageInit secsock;
RWSecureSocketPackageInit::seedRNGFromFile("seedfile.dat"); //2
RWSecureSocketContext context; //3
RWFtpsClient client(context);
client.setTimeout(60000); //4
RWInetAddr addr("ftp.roguewave.com"); //5
RWFtpsReply reply = client.connect(addr);
reply = client.auth(); //6
reply = client.user(user);
reply = client.pass(pass);
reply = client.pbsz(); //7
reply = client.prot("P");
RWFtpsDataReply dataReply = client.nlst("/pub/foo"); //8
dataReply = client.retr(remoteFile); //9
RWPortal portal = dataReply.getPortal();
RWFtpsDataReply dataReply = client.stor(localFile); //10
dataReply.getPortal().sendAtLeast("data");
dataReply = client.dataClose();
RWFtpsReply reply = client.quit(); //11
Example 16 – Retrieving Server Information via FTPS
This example illustrates retrieving information from the server, continuing after steps 1 - 7 of
Example 15.
...
reply = client.cwd("/pub/foo"); //8
RWFtpsPwdReply pwdReply = client.pwd(); //9
reply = client.quit(); //10