GetComConnectionState

int GetComConnectionState (int COMPort);

Purpose

Returns the connection state of the specified port.

Linux This function is not supported.

GetComConnectionState returns an error if you have not opened the port or if you pass an invalid value for COMPort.

Note   This function works only with NI Serial hardware. The function returns an Unknown System Error with other hardware ports.

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

Return Value

Name Type Description
state integer The current state of the port. A negative value indicates that an error occurred.

Value Description
0 No connection on this port.
1 Valid connection on this port.