[Top] [Prev] [Next] [Bottom]


[Contents] [Index]

timedio - read, write with timout

TimedIO: module
{
	PATH:		con "/dis/lib/timedio.dis";
	TIMEOUT: con -6;
	read: fn( fd: ref Sys->FD, buf: array of byte, nbytes: 
int, timeout: int) :int;
	write: fn( fd: ref Sys->FD, buf: array of byte, nbytes: 
int, timeout: int) :int;
};

Description

The TimedIO module provides read and write functions that mimic the read and write functions of the system module, but they enable a timeout period that is specified in milliseconds. If the read or write does not return before the timeout period expires, the return value is timeout.

read

read: fn( fd: ref Sys->FD, buf: array of byte, nbytes: int, 
timeout: int) :int;
The read function reads nbytes from an open file descriptor fd into buf. If the read is not completed in timeout milliseconds, the return value is timeout.

If the read operation completes before timeout milliseconds, the return value is that of sys->read (number of bytes read, or 0 for end-of-file).

write

write: fn( fd: ref Sys->FD, buf: array of byte, nbytes: 
int, timeout: int) :int;
The write function write nbytes from buf into an open file descriptor fd. If the write is not completed in timeout milliseconds, the return value is timeout.

If the write operation completes before timeout milliseconds, the return value is that of sys->write (number of bytes written).

See Also

read, write, stream - read, write, or stream file in Chapter 8


[Top] [Prev] [Next] [Bottom]

infernosupport@lucent.com
Copyright © 1997, Lucent Technologies, Inc.. All rights reserved.