Alaska Software Inc. - wodFtpServer
Username: Password:
AuthorTopic: wodFtpServer
Raffaele LafrattawodFtpServer
on Fri, 03 Apr 2015 09:05:37 +0200
Hi all

I'm using wodFtpServer, a com object to embed an ftp server in my 
application

I discovered that usual way to answer to events from Alaska is extremely 
slow

com documentation says it is possible fast notification in the way below 
  ( Vb example )

The question is

How can I implement the IwodFTPDNotify ( as explained below)
Is it a sort of callback function ?
How I can translate vb code example ?

Dim FTPD1 as wodFTPDCom
Implements IwodFTPDNotify
...
Set FTPD1.Notification = Me





"
As you might have read so far, wodFTPServer (only its COM/DLL version) 
can use fast notification interface instead of firing events. This means 
that each time wodFTPD needs to fire an event, it will call your 
implementation of the event instead. Notifications can be 30 times 
faster than events - meaning it is advised to be used if speed is needed 
in your applications.

wodFTPD ActiveX DOES NOT support notifications - only wodFTPDCom 
component does!

You must declare ALL notification methods if you want to implement 
IwodFTPDNotify, no matter if you need them or not. For example, many 
users don't need LoginCertificate event, but at least empty body for 
this event MUST exist when notifications are used.

You can read below steps required to implement your own IwodFTPDNotify 
interface. As an example, we will put it on the main form. You can also 
put it into separate VB class, in which case instead of 'Me' keyword, 
you will use name of the class.

Steps needed to implement IwodFTPDNotify:
Add Reference to wodFTPDCom COM Object to your application
Instead of declaring wodFTPD like this:

Dim WithEvents FTPD1 as wodFTPDCom


you should do this:

Dim FTPD1 as wodFTPDCom
Implements IwodFTPDNotify


In Form_Load, create new instance for FTPD1, and pass reference of our 
IwodFTPDNotify to it

Set FTPD1 = new wodFTPDCom
Set FTPD1.Notification = Me


Implement ALL methods, or at least declare their empty bodies. You can 
do it automatically if you locate 'IwodFTPDNotify' object in the list of 
all objects existing on your form (combo box in upper left corner of 
your code view), or just can do it by hand.
All done. Now put breakpoints to your methods. You will see that instead 
of fired event, your methods will be called instead.


Method declarations

Private Sub IwodFTPDNotify_ChangeDir(ByVal Owner As 
wodFTPDComLib.IwodFTPDCom, ByVal User As wodFTPDComLib.IFtpUser, ByVal 
RelativePath As String, ResolvedPath As String, Action As 
wodFTPDComLib.FtpActions)

End Sub

Private Sub IwodFTPDNotify_Command(ByVal Owner As 
wodFTPDComLib.IwodFTPDCom, ByVal User As wodFTPDComLib.IFtpUser, CmdLine 
As String)

End Sub
.........
"

Thanks to all

Raffaele Lafratta
Pascal BoivinRe: wodFtpServer
on Fri, 03 Apr 2015 22:13:28 +0200
I don't know if XBase can create an object compatible to a COM
interface.  In VB or C# you have to create a class from the interface.
It would look like this in xbase:

CLASS TFTPNotify FROM IwodFTPDNotify
 ...
ENDCLASS

YourFTPNotify := TFTPNotify():Create()
...
FTPD1.Notification = YourFTPNotify
Then FTPD1 will call method in your TFTPNotify class.

I have not use COM object from xbase so I have no idea if this is
possible.


Another solution is in AsiNet if you have it with your xbase package.
It include an FTP object ready to use.

#pragma Library( "ASINet10.lib" ) 

PROCEDURE Main 

  LOCAL cFtpServer := "my_ftpserver.com" 
  LOCAL cUserName  := "my_Username" 
  LOCAL cPassword  := "my_password" 
  LOCAL oFtp, cContents 

  oFtp := FTPClient():new( cFtpServer, cUserName, cPassWord ) 

  IF .NOT. oFtp:connect() 

	 ? "Unable to establish connection to:" , cFtpServer 
	 QUIT 
  ENDIF 

  cContents := Memoread( "c:\filename.txt" ) 

   Uploading file contents 
  IF .NOT. oFtp:put( "ftp_dir\filename.txt", cContents ) 
	 ? "Unable to transfer file contents" 
  ELSE 
	  Downloading file contents 
	 ? oFtp:get( "ftp_dir\filename.txt" ) 
  ENDIF 

  oFtp:disconnect() 


RETURN
Raffaele LafrattaRe: wodFtpServer
on Tue, 07 Apr 2015 09:32:55 +0200
Il 03/04/2015 22.13, "Pascal Boivin" ha scritto:
> I don't know if XBase can create an object compatible to a COM
> interface.  In VB or C# you have to create a class from the interface.
> It would look like this in xbase:
>
> CLASS TFTPNotify FROM IwodFTPDNotify
>   ...
> ENDCLASS
>
> YourFTPNotify := TFTPNotify():Create()
> ...
> FTPD1.Notification = YourFTPNotify
> Then FTPD1 will call method in your TFTPNotify class.
>
> I have not use COM object from xbase so I have no idea if this is
> possible.
>
>
> Another solution is in AsiNet if you have it with your xbase package.
> It include an FTP object ready to use.
>
> #pragma Library( "ASINet10.lib" )
>
> PROCEDURE Main
>
>    LOCAL cFtpServer := "my_ftpserver.com"
>    LOCAL cUserName  := "my_Username"
>    LOCAL cPassword  := "my_password"
>    LOCAL oFtp, cContents
>
>    oFtp := FTPClient():new( cFtpServer, cUserName, cPassWord )
>
>    IF .NOT. oFtp:connect()
>
> 	 ? "Unable to establish connection to:" , cFtpServer
> 	 QUIT
>    ENDIF
>
>    cContents := Memoread( "c:\filename.txt" )
>
>     Uploading file contents
>    IF .NOT. oFtp:put( "ftp_dir\filename.txt", cContents )
> 	 ? "Unable to transfer file contents"
>    ELSE
> 	  Downloading file contents
> 	 ? oFtp:get( "ftp_dir\filename.txt" )
>    ENDIF
>
>    oFtp:disconnect()
>
>
> RETURN
>
>
Thanks for the answer Pascal
The com object I'm using is an ftp server ( not a client)

Best Regards

Raffaele