maddog
|
FTP4W.DLL provides an implementation of the FTP protocol (specified in the RFC 959). It is a Windows Dynamic Library (DLL), which can be used by any language (and any compiler). It requires a Windows Sockets DLL (Winsock.DLL).
FTP4W provides four groups of functions:
Local Functions
Connection functions
Data transfer functions
FTP Commands functions
The data transfer functions can be used in two modes:
If the application chooses the synchronous mode (set by the FtpSetSynchronousMode function), all the FTP4W calls will return when the task is finished. Each function returns an integer return-code.
If the application chooses the asynchronous mode (set by FtsetAsynchronousMode), the data transfer function (and FtpLogin) will return before the task has been done. The application must wait for a message posted by the DLL when the job is over. The message contains two arguments wParam and lParam (please refer to a Windows programmer's reference) which are used to pass information such as return codes. The functions return an integer which is FTPERR_OK if the request is accepted, and an error code such as FTPERR_NOTINITIALIZED if it is rejected (in this case the application will receive no message).
Synchronous functions have been implemented because some languages can not handle user defined messages, but it is recommended to use asynchronous versions.
Asynchronous calls give the application a way to follow the progress of a data transfer. The DLL posts a message for the application each time it receives a packet of data. This message contains two arguments:
wParam: FALSE (operation not completed)
lParam : number of bytes received/sent
The FTP4W calls do not need any handle to identify the FTP session. Rather, they use the Windows function GetCurrentTask (or GetCurrentThreadId) to get a task identifier. This mechanisms avoids the use of a argument but it prohibits having more than one FTP session for a given thread (note that if the same application is started twice, FTP4W will just see two differents tasks, so each application can have its own FTP session).
|