omron — IOSTAT real-valued function

IOSTAT real-valued function FCLOSE (dlun) DETACH (dlun) In the following example a TCP server program segment performs a no-wait read and then checks the status to determine whether a client connection or disconnection was made. ATTACH (lun,4) "TCP" IF IOSTAT (lun) 0 THEN TYPE "Attach error: ", $ERROR(IOSTAT(lun)) END no_wait = 1 READ (lun, handle, no_wait) $in.str status = IOSTAT(lun) CASE status OF VALUE 1: ;Data received TYPE "Data received. Handle =", handle VALUE 100: ;New connection opened TYPE "New connection established. Handle =", handle VALUE 101: ;Connection closed TYPE "Connection closed. Handle =", handle VALUE -526:

;No data received WAIT ANY ;Some other error TYPE "Error during READ: ", $ERROR(status) GOTO 100 END Related Keywords ATTACH program instruction FCLOSE program instruction FCMND program instruction FEMPTY program instruction FOPEN program instruction FSEEK program instruction READ program instruction WRITE program instruction eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 306