|
PortController.NET
SendFileXModem Method
Sends a file using the XMODEM protocol.
Syntax
[Visual Basic]
object.SendFileXModem(FileName)
[C#]
object.SendFileXModem(FileName)
[C++]
object->SendFileXModem(FileName)
Parameters
object
An object expression that evaluates to a PortController object.
FileName
A string containing an absolute or relative filename to be sent.
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 sends files using either the XMODEM or XMODEM-CRC protocol, depending on the receiver's preference.
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 found, PortController throws FileNotFoundException
- If an error occurs during the transfer, the OnFileTransferComplete event is fired
with the type of error
Example
[Visual Basic]
myPortController.SendFileXModem("C:\MySendFile.bin")
[C#]
myPortController.SendFileXModem("C:\\MySendFile.bin");
[C++]
myPortController->SendFileXModem("C:\\MySendFile.bin");
See Also
ReceiveFileXModem method | SendFileXModem1k method | CancelFileTransfer method |
OnFileTransferStatusUpdate event |
OnFileTransferComplete event
|