int GetComConnectionState (int portNumber);
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 portNumber.
![]() |
Note This function works only with NI Serial hardware. The function returns an Unknown System Error with other hardware ports. |
| Input | ||
| Name | Type | Description |
|---|---|---|
| portNumber | integer | A number that indicates the COM port on which to operate. This number maps to the COM port specified by deviceName in the call to OpenCom or OpenComConfig. The portNumber 1, for example, may not necessarily map to COM1. Linux The portNumber 1, for example, may not necessarily map to /dev/ttyS0. Valid Range: 1—1,000 |
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
| state | integer | The current state of the port. A negative value indicates that an error occurred.
|