HTBasic Help
×
Menu
Index

ON TIMEOUT

Defines an event branch for an I/O timeout.
 
 ON TIMEOUT interface-select-code, seconds action
 
Usage:
ON TIMEOUT 4,5 GOTO 2000
ON TIMEOUT Printer,Sec GOSUB Message
ON TIMEOUT 4,1/2 RECOVER Line
 
Example:           ON TIMEOUT.BAS
 
Description:
ON TIMEOUT defines an event branch to take when an I/O operation on the specified interface fails to responded within the specified number of seconds. The value of seconds can range from 0.001 to 32.767 but is rounded to the timing resolution of the computer. The ON TIMEOUT statement must be executed before the I/O statement. If an ON TIMEOUT is not specified for a particular interface and a device does not respond to an I/O action, the computer will wait forever. Pressing the CLR I/O key will abort such an infinite wait.
 
TIMEOUTs work with the ENTER, OUTPUT, PRINTALL IS, PRINTER IS and PLOTTER IS statements, but not with the CONTROL, STATUS, READIO or WRITEIO statements or with the CRT or KBD interfaces or with files.
 
ON TIMEOUT is canceled by OFF TIMEOUT but is not disabled by DISABLE. A SUBEXIT, SUBEND, or RETURN from the defining subprogram also cancels it.
 
When returning from a CALL or GOSUB,execution continues with the line following the line causing the timeout.
More information about ON TIMEOUT can be found under the "Common Information" heading of the ON END manual entry.
 
See Also: