Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Secure Communication Module User's Guide

10.3 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.

//1

Initialize winsock (if necessary) and the Secure Sockets package.

//2

Seed the Random Number Generator (RNG) with the data in the provided file.

//3

Establish an SSL/TLS context and create the FTPS client.

//4

Set a timeout in milliseconds for the client to wait to connect.

//5

Create an Internet address and provide it to an RWFtpsReply object, then connect to the server.

//6

Request a secure session using the AUTH protocol command. Once the server confirms the connection, the client then provides login credentials using the standard protocol commands USER and PASS.

//7

Encrypt the data channel. The command PBSZ sets the protection buffer size to 0 as required by the FTPS standard. This command must be followed by the PROT command to secure the data channel. Note that the protection level is set to "P" or "private."

//8

Use the specialization class RWFtpsDataReply to receive data returned by the server, in this case, the list of files. This object contains an RWPortal that acts as the connection to the remote server.

//9

Retrieve a file from the server. (See Chapter 4, "Portals," in the Essential Networking Module User's Guide for information on retrieving the contents of the portal.

//10

Put a file on the server using the protocol command STOR. This method must be followed by a call to dataClose() to complete the data transfer.

//11

Closes the connection.

Example 16: Retrieving Server Information via FTPS

This example illustrates retrieving information from the server, continuing after steps 1 - 7 of Example 15.

//8

Change directories to foo.

//9

Use the specialization class RWFtpsPwdReply to receive the results of the PWD protocol command.

//10

Close the connection.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.