|
The timeout attribute of cport defines detailed read/write timeout settings.
When the time-out period of a special operation reaches, the operation is abandoned and no errors are generated.
The timeout parameter can be used to define two types of timeout.
An interval timeout occurs when the accept interval of two bytes exceeds the specified time.
A total timeout occurs when the read operation exceeds a certain period of time. The timing starts from the I/O operation.
Write operations only support total timeout.
Read operations support two timeouts.
The unit of the specified time is ms.
Parameters:
[Readinterval] -- specifies the read interval timeout time.
The value 0 indicates that the time-out period is not applied.
-When the value 1 is combined with readtotalconstant and readtotalmultiplier, both are 0, and the specified read operation returns the received
Bytes, even if it does not contain any bytes.
[Readtotalconstant] -- specifies the total timeout time.
For each read operation, the sum of this value and the product of readtotalmultiplier and number of cells is the total timeout time.
If both readtotalmultiplier and readtotalconstant are 0, the total timeout time is not applied.
If an applicationProgramSet both readinterval and readtotalmultiplier to-1, and set
If readtotalconstant is greater than 0, one of the following situations occurs:
If the input buffer contains any bytes, the READ function immediately returns these bytes;
If there are no bytes in the input buffer, the READ function waits for the bytes until the bytes arrive and returns the bytes immediately;
If no Bytes are returned within the time specified by readtotalconstant, the read operation times out.
[Readtotalmultiplier] -- specify the multiplier of read Total timeout.
If both readtotaltimeout and readtotalconstant are 0 values, the total timeout time is not applied. Note: if both are set to 0, connection failure may cause a crash. Because no timeout detection exists.
[Writetotalconstant] -- specifies a constant used to calculate the total timeout value of a write operation.
For each write operation, the sum of this value and the product of writetotalmultiplier and number of cells is from the timeout time.
Both writetotalmultiplier and writetotalconstant are 0, indicating that the total timeout time is not applied to write operations.
[Writetotalmultiplier] -- specify the multiplier of write total timeout.
If both writetotaltimeout and writetotalconstant are 0 values, the total timeout time is not applied.
In easywatch2.0, I set the cport timeout as follows:
Readinterval: = 20;
Readtotalconstant: = 2000;
Readtotalmultiplier: = 200;
Writetotalconstant: = 200;
Writetotalmultiplier: = 20;
|