WebFtpConnect Function

Action

Connects to the FTP server specified by sUrl. You cannot connect to an FTP server via CERN proxies. Use WebUrl in that case. The handle returned in hFtp has to be used with all subsequent WebFtp function calls.

Include file

WebAPI.bdh

Syntax

WebFtpConnect( out hFtp  : number, 
               in  sHost : string, 
               in  nPort : number, 
               in  sUser : string, 
               in  sPass : string ): boolean;

Return value

  • true if the connection could be established

  • false otherwise

Parameter Description
hFtp

Variable receiving the handle to the FTP session.

If this parameter contains a handle to an FTP session prior to the WebFtpConnect function call, the memory allocated with the handle is released. Whenever you want to create a new FTP session, make sure this variable is initialized with 0 (this is automatically done within transactions when they are executed for the first time, but not within functions).

sHost Host name of the remote FTP server to connect to.
nPort Remote port to connect to. Use WEB_PORT_FTP to connect to the standard port.
sUser User name
sPass Password

Example

dcltrans 
  transaction TMyTransaction 
  var
    hFtp: number; 
  begin 
    WebFtpConnect(hFtp, "standardhost", WEB_PORT_FTP, "", "");
    WebFtpShutdown(hFtp); 
  end TMyTransaction;

Sample scripts

WebMulti01.bdf

SilkEssential sample

Ftp.sep