| Dart Home | PowerTCP FTP for ActiveX | Custom Development | Reply | PowerTCP FTP for ActiveX Topics | Forums |
| Author | Forum: PowerTCP FTP for ActiveX Topic: FTP Tool - non blocking |
| piotr_aryko From: Cracow, Poland Posts: 1 Member Since: 11/08/06 |
posted November 8, 2006 6:53 AM Hi Does anybody know how to use non blocking method in FTP Tool ActiveX. When timeout is set to 0 cannot establish connection with ftp server because ftp control connects and disconnect |
| Amit From: Rome, NY USA Posts: 315 Member Since: 03/15/06 |
posted November 8, 2006 4:05 PM Hi, When you use non-blocking techniques, operations will occur transparently. When you do this, your code will immediately execute the next line of code and it is up to you to determine the success or failure of the method using the feedback provided in the Progress event. Here is a simple code snippet which achieves the desired scenario: Private Sub Command1_Click() 'Specify the Timeout to 0 Ftp1.TimeOut = 0 'Login to an FTP Server Ftp1.Login "ServerName", "UserName", "Password" End Sub Private Sub Ftp1_Progress(ByVal FtpCmd As DartFtpCtl.CommandConstants, ByVal Status As DartFtpCtl.StatusConstants, ByVal Reply As String, ByVal Count As Long, ByVal Size As Long) If Status = ftpOk Then 'Use Select to control what to do next Select Case FtpCmd Case ftpPassword 'User is logged in, issue Store command Ftp1.Store "testing2345.txt", "D:\test1.txt" Case ftpStore 'File transfer is complete, so log out of the server Ftp1.Logout End Select End If End Sub Regards, Amit |
| zathrasb5 From: Atlanta, GA USA Posts: 8 Member Since: 07/12/04 |
posted December 29, 2006 11:01 AM I tried this code in a VBScript, and I get the following error: Expected ')' line/char refers to the first "As" in Sub FTP1_Progress. Any ideas? Or an example of a VBscript with no user interface (script will be run by an Alerts app that runs as a service). |
| Amit From: Rome, NY USA Posts: 315 Member Since: 03/15/06 |
posted December 29, 2006 1:39 PM Hi, The said error message suggests that the error is being thrown by the Progress Event. How are you using this Event in VBScript environment? I am not much experienced in VBScript so I am not familiar with any way through which user may use events in VBScript. In VB, you may use following code to declare the control: Private Withevents Ftp1 As Ftp Also note that FTP can be used in blocking as well as non-blocking mode. Currently, you are using non-blocking mode. Have you tried using Blocking mode? Here is a small code snippet which uses blocking mode: ' Login to the server Ftp1.Login "myftpserver", "user", "pass" ' This is an ASCII text file Ftp1.Type = ftpAscii ' Store the file "myfile.txt" Ftp1.Store "mystoredfile.txt", "C:\test\myfile.txt" ' Logout Ftp1.Logout Regards, Amit |
| Reply | PowerTCP FTP for ActiveX Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|