This example illustrates the use of ProFTPClient in explicit FTPS mode with neither server nor client validation. This is not recommended usage since there is no way for either party to ensure that the other party is who it claims to be, but it serves well to illustrate basic usage.
The example performs the following operations:
You can view the source-code here.
run hostname username password filenamewhere
INFO [NonvalidatingClient] 26 Jan 2005 16:40:45.927 : Creating FTPS (explicit) client INFO [NonvalidatingClient] 26 Jan 2005 16:40:45.947 : Turning off server validation INFO [NonvalidatingClient] 26 Jan 2005 16:40:45.947 : Connecting to server LOCALHOST INFO [NonvalidatingClient] 26 Jan 2005 16:40:47.189 : Switching to FTPS (explicit mode) INFO [NonvalidatingClient] 26 Jan 2005 16:40:47.569 : Logging in with username=test and password=test INFO [NonvalidatingClient] 26 Jan 2005 16:40:47.599 : Setting up passive, ASCII transfers INFO [NonvalidatingClient] 26 Jan 2005 16:40:47.609 : Directory before put: INFO [NonvalidatingClient] 26 Jan 2005 16:40:47.970 : no files INFO [NonvalidatingClient] 26 Jan 2005 16:40:47.970 : Putting NonvalidatingClient.exe to server INFO [NonvalidatingClient] 26 Jan 2005 16:40:48.270 : Directory after put: INFO [NonvalidatingClient] 26 Jan 2005 16:40:48.491 : -rw-r--r-- 1 SYSTEM None 16238 Jan 26 06:40 NonvalidatingClient.exe INFO [NonvalidatingClient] 26 Jan 2005 16:40:48.491 : Getting NonvalidatingClient.exe from server and saving as NonvalidatingClient.exe.copy INFO [NonvalidatingClient] 26 Jan 2005 16:40:48.811 : Deleting NonvalidatingClient.exe INFO [NonvalidatingClient] 26 Jan 2005 16:40:48.821 : Directory after delete: INFO [NonvalidatingClient] 26 Jan 2005 16:40:49.172 : no files INFO [NonvalidatingClient] 26 Jan 2005 16:40:49.172 : Quitting client INFO [NonvalidatingClient] 26 Jan 2005 16:40:49.182 : Example completeThere should now also be a file called YourFilename.copy in the local directory.