ge
tstring, putstring, getbytearray, putbytearray, puterror- delimited I/O
include "keyring.m"
keyring:= load Keyring Keyring->PATH;
getstring: fn(fd: ref Sys->FD) : (string, string);
putstring: fn(fd: ref Sys->FD, s: string): int;
getbytearray:fn(fd: ref Sys->FD) : (array of byte, string);
putbytearray: fn(fd: ref Sys->FD,a: array of byte, n: int):
int;
puterror: fn(fd: ref Sys->FD, s: string): int;
Description
This collection of routines provides delimited I/O for strings, byte arrays and error strings over arbitrary networks.
getstring (fd)
The getstring function reads a text string from the file descriptor supplied as its argument. The return value is a tuple of the form (result, error). If successful, the error string is nil.
putstring (fd, s)
The putstring function writes the string supplied as its second argument to the file descriptor supplied as its first argument. It returns the number of bytes written to the network or -1 if an error occurred. Messages sent by putstring are truncated to 4096 bytes in length.
getbytearray (fd)
The getbytearray function reads an array of bytes from the file descriptor supplied as its argument and returns a tuple of the form (result, error). If successful the error string is nil.
putbytearray (fd, arr, n)
The putbytearray function writes an array of bytes supplied as its second argument to the file descriptor supplied as its first argument. It returns the number of bytes written to the network or -1 if an error occurred. Messages sent by putbytearray are truncated to 4096 bytes in length.
puterror (fd, s)
The puterror function writes an error string supplied as its second argument to the file descriptor supplied as its first argument. This function can be used in place of putstring or putbytearray to cause the corresponding getstring or getbytearray to fail, yielding the error string. The error string may not be longer than ERRLEN bytes.
Diagnostics
The putstring, putbytearray, and puterror functions return -1 if there is an I/O error. The getstring and getbytearray functions return a string indicating the cause of the error in the second element of the tuple that forms their return value.
infernosupport@lucent.com
Copyright © 1996,Lucent Technologies, Inc. All rights
reserved.