LInetFtp::LInetFtp
#include "ltwrappr.h"
L_VOID LInetFtp::LInetFtp(L_VOID)
L_VOID LInetFtp::LInetFtp(pszServer, pszUserName = NULL, pszPassword = NULL, nPort = 21)
L_TCHAR *pszServer; |
/* name of server to connect to */ |
L_TCHAR *pszUserName; |
/* username for authentication */ |
L_TCHAR *pszPassword; |
/* password for authentication */ |
L_INT nPort; |
/* port number to connect to */ |
Constructs and initializes the member variables of the LInetFtp object.
Parameter |
Description |
pszServer |
Character string that contains the host name of an FTP server. This can be a URL, like ftp.leadtools.com, or it can contain the IP number of the site, in ASCII dotted-decimal format (for example, 208.35.195.11). |
pszUserName |
Character string that contains the name of the user logging on. Default value is NULL. This is a NULL-terminated string. |
pszPassword |
Character string that contains the password to use when logging on. Default value is NULL. This is a NULL-terminated string. |
nPort |
Number of the TCP/IP port on the server to connect to. These flags set only the port that will be used. Use the default port for FTP servers: INTERNET_DEFAULT_FTP_PORT (port 21). |
Returns
None
Comments
LInetFtp::LInetFtp() is the default LInetFtp constructor. After calling the this constructor, a user must call LInetFtp::Connect to establish a connection before using other functions.
LInetFtp::LInetFtp(pszServer, pszUserName = NULL, pszPassword = NULL, nPort = 21) is a constructor for the LInetFtp object. It connects to the FTP server. If both pszUserName and pszPassword are NULL, the connection is made anonymously.
A connection to an FTP server must be established before using any other FTP functions. If a connection is disconnected, via either LInetFtp::Disconnect or LInetFtp::~LInetFtp, then a connection must be re-established before any other FTP functions are called. LInetFtp::Connect and LInetFtp::LInetFtp can be used to establish a connection with an FTP server.
Required DLLs and Libraries
LTFIL For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application |
See Also
Functions: |
|
Topics: |
|
|
Example
//This example for LInetFtp::LInetFtp(L_VOID)
//This example for LInetFtp::LInetFtp(L_VOID) // This will call the default constructor and destructor when it is out of scope L_INT LInetFtp_LInetFtpExample_1() { LInetFtp InetFtp; // other code return SUCCESS; } //----------------------------------------------------------------------------------------------------------------------- /*This example for LInetFtp::LInetFtp(pszServer, pszUserName = NULL, pszPassword = NULL, nPort = 21)*/ // This example simulates storing a file on an FTP server L_INT LInetFtp_LInetFtpExample_2(HWND hWndParent, L_TCHAR *pszSourceFileName, L_TCHAR *pszDistFileName) { L_INT nRet; LInetFtp InetFtp(TEXT("www.leadtools.com")); // Checking if the connection failed nRet = InetFtp.GetErrorFromList (); if(nRet != SUCCESS) { InetFtp.DisplayError (hWndParent, TEXT("Can't connect to the FTP server")); return nRet; } nRet = InetFtp.CreateDir (TEXT("MyDirName")); if(nRet != SUCCESS) { InetFtp.DisplayError(hWndParent, TEXT("Can't create a directory")); return nRet; } nRet = InetFtp.SendFile (pszSourceFileName, pszDistFileName, SENDAS_BINARY); if(nRet != SUCCESS) { nRet = InetFtp.DeleteDir (TEXT("MyDirName")); if(nRet != SUCCESS) return nRet; InetFtp.DisplayError (hWndParent, TEXT("Error while send the file")); return nRet; } return SUCCESS; }