|
PortController.NET
ReceiveFileZModem Method
Receives one or more files using the ZMODEM protocol.
Syntax
[Visual Basic]
object.ReceiveFileZModem(PathName [, Binary = True])
[C#]
object.ReceiveFileZModem(PathName [, Binary = true])
[C++]
object->ReceiveFileZModem(PathName [, Binary = true])
Parameters
object
An object expression that evaluates to a PortController object.
PathName
A string containing an absolute or relative pathname indicating where the received files are to be saved.
[optional] Binary
A Boolean value indicating whether the files to be received are binary files. Defaults to true.
Return Value
None
Remarks
- This method saves one or more files to the filenames supplied by the sender. Unlike the
ReceiveFileXModem method or the ReceiveFileXModemCRC
method, ReceiveFileZModem takes a pathname as its first arguent instead of a filename.
- This method initiates a file transfer on a background thread and then returns immediately.
When the transfer is complete, the OnFileTransferComplete event is fired containing
a success or error code.
- Once the transfer has begun, the OnFileTransferStatusUpdate event
is fired periodically until the transfer completes or is cancelled.
- During the file transfer, no events are fired except for OnFileTransferStatusUpdate and
OnFileTransferComplete.
- The transfer may be cancelled by calling the CancelFileTransfer method.
- If the specified filename(s) already exists and the file is the same size as the file to be transferred,
PortController signals to the sender that the file has already been received and terminates the transfer.
- If the specified filename(s) already exists and the file is smaller than the file to be transferred,
PortController signals to the sender to transfer only the part of the file that has not yet been transferred.
Errors
- If this method is called while a file transfer is already in progress, PortController throws a "Unable to begin file transfer because a transfer is already in progress." exception
- Since ZMODEM filenames are specified by the sender, all file path/permission errors are communicated through the OnFileTransferComplete event
- If an error occurs during the transfer, the OnFileTransferComplete event is fired
with the type of error
Example
[Visual Basic]
myPortController.ReceiveFileZModem("C:\", True)
[C#]
myPortController.ReceiveFileZModem("C:\\", true);
[C++]
myPortController->ReceiveFileZModem("C:\\", true);
See Also
SendFileZModem method | CancelFileTransfer method |
OnFileTransferStatusUpdate event |
OnFileTransferComplete event
|