|
PortController.NET
ReceiveFileXModem Method
Receives a file using the XMODEM protocol.
Syntax
[Visual Basic]
object.ReceiveFileXModem(FileName [, Binary = True])
[C#]
object.ReceiveFileXModem(FileName [, Binary = true])
[C++]
object->ReceiveFileXModem(FileName [, Binary = true])
Parameters
object
An object expression that evaluates to a PortController object.
FileName
A string containing an absolute or relative pathname where the received file is to be saved.
[optional] Binary
A Boolean value indicating whether the file to be received is a binary file. Defaults to true.
Return Value
None
Remarks
- 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.
- This method receives files sent using both the XMODEM and the XMODEM-1K protocol.
- If the specified filename already exists, it is overwritten with the received file.
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
- If the specified file cannot be written, PortController throws the corresponding System.IO exception
- If an error occurs during the transfer, the OnFileTransferComplete event is fired
with the type of error
Example
[Visual Basic]
myPortController.ReceiveFileXModem("C:\MyReceivedFile.bin", True)
[C#]
myPortController.ReceiveFileXModem("C:\\MyReceivedFile.bin", true);
[C++]
myPortController->ReceiveFileXModem("C:\\MyReceivedFile.bin", true);
See Also
SendFileXModem method | ReceiveFileXModemCRC method | CancelFileTransfer method |
OnFileTransferStatusUpdate event |
OnFileTransferComplete event
|