Help / WLanguage / WLanguage functions / Communication / Net functions
  • Progress of file transfer
  • Frequency of the event
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
This function is kept for backward compatibility. It is recommended to use a standard FTP, SSH or SCP server. For more details, see Handling files on an FTP server and Standard FTP functions.
Retrieves an existing file from an FTP server (File Transfer Protocol) powered by WINDEV. The file is retrieved by the client computer.
Remark: To allow (or not) the use of this function on an FTP/RPC server, call NetServerOption.
// -- Code of button for file retrieval
IF NetGetFile(ConnectFTP, "C:\autoexec.bat", "C:\autoexec.cli", ...
Error("Error while transferring the file")
<Result> = NetGetFile(<Connection identifier> , <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 identifier>: 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 follow 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.

Progress of file transfer

The progress of the file transfer is managed in the FTP client program only.
NetGetFile is not a blocking function: the file transfer is performed in background task. 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 follow the progress of transfer. 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 progress bar by using the parameters of the message (_EVE.lParam and _EVE.wParam),
  • find out whether file transfer is completed (in this case, _EVE.lParam = _EVE.wParam).

Frequency of the event

<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 100KB file and a 10% frequency, about 10 messages will be received: 1 message whenever 10 KB are transferred. In fact, the number of messages will be less because the transfer is fast.
Tips regarding the choice of frequency:
  • If no progression bar is displayed, the best choice for the frequency is set to 100%: A single message will be received when the file transfer is completed.
  • 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.
Component: wd300com.dll
Minimum version required
  • Version 9
This page is also available for…
Click [Add] to post a comment

Last update: 06/07/2023

Send a report | Local help