<< Back


FVSDK_Disconnect

Synopsis

FVSDK_ERROR_CODE FVSDK_Disconnect(FVSDK_Session* pSession);

Description

Disconnects from the server. This function may be called after any successful FVSDK_Connect() call.

Parameters

pSession

A pointer to a valid FVSDK_Session structure.

Return Value

FVSDK_OK if the disconnect is successful; error codes can be found in FVSDK_ErrorCodes.h.

Example

FVSDK_Session*  pSession;

// create a new session
if (FVSDK_NewSession(&pSession) == FVSDK_OK) {

    // set the server name to connect to
    pSession->pszServer = "ftp.yourserver.com";

    // set the user id to use during the connection
    pSession->pszUserID = "youruserid";

    // set the password to use during the connection
    pSession->pszPassword = "yourpassword";

    // try to connect to the server, display an error message if we were unable to connect
    if (FVSDK_Connect(pSession) == FVSDK_OK) {

        // ... perform some operations ...

        // disconnect from the server
        FVSDK_Disconnect(pSession);
    } // if
    else
        AfxMessageBox("Unable to connect to the specified server");

    // release (deallocate) the session
    if (FVSDK_FreeSession(pSession) != FVSDK_OK)
        AfxMessageBox("Unable to release the session");
} // if
else
    AfxMessageBox("Unable to create a new session.");