# SetComTime

int SetComTime (int COMPort, double timeoutSeconds);

## Purpose

Sets timeout limit for input/output operations.

For read operations, timeout occurs when the COM port input queue is empty and no byte is read into the queue for the duration of the timeout time.

For write operations, timeout occurs when the COM port output queue is full and LabWindows/CVI cannot write to the queue for the duration of the timeout time.

SetComTime returns an error if you have not opened the port or if you pass an invalid parameter value.

## 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
timeoutSeconds | double-precision | The timeout limit for I/O operations for the selected port. For an RS-232 read operation, timeoutSeconds specifies the time the library allows from the start of the transfer to the arrival of the first byte. timeoutSeconds also specifies the time the library allows to elapse between the arrival of any two consecutive bytes. An RS-232 read operation waits for at least the amount of time you specify for the next incoming byte before it returns a timeout error. For an RS-232 write operation, timeoutSeconds specifies the time the library allows before the first byte is transferred to the output queue. timeoutSeconds also specifies the time the library allows between the transfer of any two consecutive bytes to the output queue. The transfer of bytes to the output queue can stall if the output queue is full and hardware or software handshaking is held off. If the holdoff is not resolved within the timeout period, the RS-232 write operation returns a timeout error. If timeoutSeconds is zero, timeouts are disabled, and the read or write functions wait indefinitely for the operation to complete. The default value is 5 seconds.

## 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.