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. We recommend using a standard FTP, SSH or SCP server.. For more details, see Handling files on an FTP server and Standard FTP functions.
Transmits a file to an FTP server (File Transfer Protocol) powered by WINDEV. This file can be retrieved on the FTP server by NetGetFile.
Remark: To allow (or not) the use of this function on an FTP/RPC server, call NetServerOption.
IF NetSendFile(ConnectFTP, "C:\autoexec.bat", ...
"C:\autoexec.cli", "SendFile", 10) = False THEN
Info("The transfer failed")
<Result> = NetSendFile(<Connection identifier> , <File on client computer> , <File on server> [, <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 client computer>: ANSI character string
Full name (name and path) of file to copy, found on the client computer.
<File on server>: ANSI character string
Full name (name and path) of file copied to the server.
<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.
NetSendFile 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 NetSendFile:
  • a progression message (<Event> parameter),
  • a frequency (<Event frequency> parameter).
NetSendFile 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), we advise you to display a progress bar. A frequency of 10% is appropriate in most cases.
  • If the transfer rate is fast (local network), we do not recommend that you use a small frequency (1% for example) because the amount of messages received could saturate the system. In this case, a frequency of 10% is appropriate in most cases.
Component: wd280com.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