FVSDK_ERROR_CODE FVSDK_Connect(FVSDK_Session* pSession);
Connects to the server specified in pSession->pszServer using the options and parameters set in pSession.
pSession
A pointer to a valid FVSDK_Session structure. Elements such as pSession->pszServer must be set to the desired server.
FVSDK_OK if the connection attempt is successful; error codes can be found in FVSDK_ErrorCodes.h.
// create the session structure
FVSDK_Session Session;
// initialize the structure
Session.nVersion = FVSDK_SESSION_CURRENT_VERSION;
Session.nSize = sizeof(Session);
// initialize the session in the SDK
if (FVSDK_InitSession(&Session, FALSE) == FVSDK_OK) {
// set the server name to connect to
Session.pszServer = "ftp.yourserver.com";
// set the user id to use during the connection
Session.pszUserID = "youruserid";
// set the password to use during the connection
Session.pszPassword = "yourpassword";
// try to connect to the server, display an error message if we were unable to connect
if (FVSDK_Connect(&Session) == FVSDK_OK) {
// ... perform some operations ...
// disconnect from the server
FVSDK_Disconnect(&Session);
} // if
else
AfxMessageBox("Unable to connect to the specified server");
// close the session
if (FVSDK_CloseSession(&Session) != FVSDK_OK)
AfxMessageBox("Unable to close the session");
} // if
else
AfxMessageBox("Unable to initialize the session.");