XModemSend

int XModemSend (int COMPort, char fileName[]);

Purpose

Reads data from the specified file and sends the data in packets over the COM port.

XModemSend opens the file in binary mode and does not treat carriage returns and linefeeds as special characters. The function sends them to the receiver untouched.

XModemSend uses the XModem file transfer protocol. The receiver also must follow this protocol for this function to work properly.

If the size of the file being sent is not an even multiple of the packet size, the last packet is padded with ASCII NUL (0) bytes. For example, if the file being sent contains only the string HELLO and the packet size is 128, the packet of data sent contains the letters HELLO followed by 123 (packet size — 5) NUL bytes.

The standard XModem protocol supports only 128 and 1,024 as packet sizes. The sender sends an SOH ASCII character (0x01) to indicate that the packet size is 128 or an STX ASCII character (0x02) to indicate that the packet size is 1,024. LabWindows/CVI attempts to support any packet size. As a sender, LabWindows/CVI sends an STX character when you specify packet size as 1,024. For any other packet size, it sends an SOH character. You can specify the packet size by calling XModemConfig.

For transfers with a large packet size and a low baud rate, National Instruments recommends a large delay period.

Parameters

Input
Name Type Description
COMPort integer A number that indicates the COM port on which to operate.

This number is paired with deviceName, which represents the COM port, during the OpenComConfig function call.

Default Value: 1—COM1
Valid Range: 1—1,000
fileName string The pathname of the file to send.

Return Value

Name Type Description
result integer The result of this function call. This code is a negative value that specifies the type of error that occurred.