wwSFTP::FtpConnect

Opens a connection to the server. Actually it doesn't open the connection, but it sets up the connection properties. Actual connection occurs when a send or receive operation on the FTP connection.

All parameters to this method are options - you can also set the related properties on the wwSftp object (.cFtpServer, .cUsername, .cPassword) which is the more common use case (see example).

o.FtpConnect(lcServer, lcUsername, lcPassword)

Return Value

0 (or throws on exception)

Parameters

lcServer
SFTP Server IP Address or domain name. Note this is not a URL, just the domain name:

  • 192.127.127.5
  • mysite.com

lcUsername
Username for the server

lcPassword
Password for the server

Example

loFtp = CREATEOBJECT("wwSftp")

loFtp.cFtpServer =  "127.0.0.1"
loFtp.nFtpPort = 23
loFtp.cUsername = "tester"
loFtp.cPassword = "password"

loFtp.FtpConnect()

loFtp.FtpGetFileEx("sailbig.jpg","c:\temp\sailbig.jpg")
loFtp.FtpGetFileEx("/subfolder/sailbig2.jpg","c:\temp\sailbig2.jpg")

loFtp.FtpClose()

See also:

Class wwSFTP

© West Wind Technologies, 2023 • Updated: 08/01/17
Comment or report problem with topic