|
|
|
|
|
- Progress of file transfer
- Frequency of the event
NetGetFile (Function) In french: NetRecupereFichier Retrieves an existing file from an FTP server (File Transfer Protocol) powered by WINDEV. The file is retrieved by the client computer. Note: To enable or disable this function on an FTP/RPC server, use NetServerOption.
HourGlass(True)
IF NetGetFile(ConnectFTP, "C:\autoexec.bat", "C:\autoexec.cli", ...
WM_MYMESSAGE, 10) = False THEN
Error("Erreur dans le transfert de fichier")
END
HourGlass(False)
Syntax
<Result> = NetGetFile(<Connection ID> , <File on server> , <File on client computer> [, <Event> [, <Event frequency>]])
<Result>: Boolean - True if the transfer was performed,
- False otherwise.
The function immediately returns a status report and the transfer is performed in parallel in another Windows task
<Connection ID>: Integer Connection identifier (returned by NetConnect). <File on server>: ANSI character string Full name (name and path) of file to copy, found on the server. <File on client computer>: ANSI character string Full name (name and path) of file copied onto the client computer. <Event>: Character string or integer (optional) Custom event or Windows event sent to the client to track the progress of the transfer (see the Notes). <Event frequency>: Optional integer Frequency (in percentage of the size of the file) at which the <Event> message is sent to the client. Remarks Progress of file transfer The progress of the file transfer is managed in the FTP client program only. The function NetGetFile function is never blocking: file transfer takes place in the background. However, you have the ability to transfer a single file at a time. To transfer several files, you must wait for each file to be transferred before transferring the next one. In this case, two parameters can be used with NetGetFile: - a progression message (<Event> parameter),
- a frequency (<Event frequency> parameter).
NetGetFile sends the specified message to track the transfer progress. This message must be intercepted by Event. The message contains two parameters: - _EVE.wParam indicates the transfered size (progress indicator),
- _EVE.lParam indicates the total size of the file.
The progress message is processed in the procedure called by Event. In this procedure, you can: - display a ProgressBar using the message parameters (_EVE.lParam and _EVE.wParam),
- whether the file transfer is complete (in this case, _EVE.lParam = _EVE.wParam).
<Event frequency> is used to define the minimum frequency for sending messages. For example, for a 1 MB file and a 10% frequency, a message will be received whenever 100 KB are transferred. The frequency defines the maximum number of messages that can be received. The number of messages received is reduced when the transfer is fast. For example, for a file of 100Kb and a frequency of 10%, about 10 messages will be received: 1 message every 10Kb transferred. In fact, the number of messages will be less because the transfer is fast. Tips regarding the choice of frequency: - If no ProgressBar is to be displayed, the best choice of frequency is 100%: a single message will be received when the file transfer is complete.
- If the transfer rate is slow (transfer by modem for instance), we recommend that you display a progress bar. A frequency of 10% is appropriate in most cases.
- If the transfer rate is fast (local network for instance), we do not recommend that you use a small frequency (1% for example) because the volume of messages received could saturate the system. In this case, a frequency of 10% is appropriate in most cases.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|