| 
   Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits.  | 
L_InetFtpConnect
#include "ltweb.h"
L_LTWEB_API L_INT L_InetFtpConnect(pszServer, iPort, pszUserName, pszPassword, pFtp)
| 
 L_TCHAR *pszServer;  | 
 /* host name of an Internet server */  | 
| 
 L_INT iPort;  | 
 /* port on the server to connect to */  | 
| 
 L_TCHAR *pszUserName;  | 
 /* name of the user */  | 
| 
 L_TCHAR *pszPassword;  | 
 /* password */  | 
| 
 pHFTP pFtp;  | 
 /* pointer to a structure */  | 
Establishes a connection with the specified server.
| 
 Parameter  | 
 Description  | 
| 
 pszServer  | 
 Character string that contains the host name of an FTP server. This can be a URL, like www.leadtools.com, or it can contain the IP number of the site, in ASCII dotted-decimal format (for example, 11.0.1.45).  | 
| 
 iPort  | 
 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).  | 
| 
 pszUserName  | 
 Character string that contains the name of the user logging on. If this parameter is NULL, the function uses the default "anonymous".  | 
| 
 pszPassword  | 
 Character string that contains the password to use when logging on. If both pszPassword and pszUsername are NULL, the function uses the default "anonymous".  | 
| 
 pFtp  | 
 Pointer to a valid handle to the FTP connection.  | 
Returns
| 
 SUCCESS  | 
 The function was successful.  | 
| 
 < 1  | 
 An error occurred. Refer to Return Codes.  | 
Required DLLs and Libraries
| 
 LTWEB 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
 L_INT InetFtpConnectExample(L_TCHAR * pszSourceFileName,
                                            L_TCHAR * pszDistFileName)
{
   HFTP hFtp; 
   L_INT nRet = SUCCESS; 
   L_INT iPort = 21; //Default ftp port
   L_TCHAR szRemoteDir[MAX_PATH]; 
   nRet = L_InetFtpConnect(TEXT("ftp.Leadtools.com"), iPort, TEXT("User1"), TEXT("MyPassword"), &hFtp); 
   if(nRet!=SUCCESS) 
      return nRet;
   nRet = L_InetFtpGetFile (hFtp, TEXT(" Image.bmp "), TEXT(" ftpimage.bmp "), TRUE, SENDAS_BINARY); 
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_InetFtpRenameFile (hFtp, TEXT(" ImageOldName.bmp "), TEXT(" ImageNewName.bmp "));
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_InetFtpDeleteFile (hFtp, TEXT(" File1.txt"));
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_InetFtpChangeDir (hFtp, TEXT(" MyRootDirName "));
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_InetFtpCreateDir (hFtp, TEXT(" MyNewSubDirName1"));
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_InetFtpCreateDir(hFtp, TEXT(" MyNewSubDirName2"));
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_InetFtpSendFile (hFtp, pszSourceFileName, pszDistFileName, SENDAS_BINARY); 
   if(nRet!=SUCCESS)
      return nRet;
   nRet = L_InetFtpDeleteDir (hFtp, TEXT(" MyNewSubDirName2"));
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_InetFtpGetCurrentDir (hFtp, szRemoteDir, MAX_PATH);
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_InetFtpDisConnect (hFtp);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}