Types
Milliseconds: TYPE ~ NetworkStream.Milliseconds;
AttnType:
TYPE ~ NetworkStream.AttentionType;
CompletionCode: TYPE ~ INT;
successCC: CompletionCode ~ 0;
StreamDescriptor: TYPE ~ REF StreamDescriptorObject;
StreamDescriptorObject: TYPE;
ListenerDescriptor: TYPE ~ REF ListenerDescriptorObject;
ListenerDescriptorObject: TYPE;
CC Utilities
RopeFromCC: PROC [cc: CompletionCode] RETURNS [ROPE];
AtomFromCC: PROC [cc: CompletionCode] RETURNS [ATOM];
FailureCC: PROC [cc: CompletionCode] RETURNS [BOOL] ~ INLINE { RETURN [cc # 0] };
Stream Operations
CreateStreamDescriptor: PROC [remote: ROPE, timeout: Milliseconds]
RETURNS [cc: CompletionCode, sd: StreamDescriptor];
DestroyStreamDescriptor:
PROC [sd: StreamDescriptor, abort:
BOOL]
RETURNS [cc: CompletionCode];
AddressesFromStreamDescriptor:
PROC [sd: StreamDescriptor]
RETURNS [cc: CompletionCode, local:
ROPE ¬
NIL, remote:
ROPE ¬
NIL];
Send: PROC [sd: StreamDescriptor, block: IO.UnsafeBlock]
RETURNS [cc: CompletionCode];
SetPutTimeout: PROC [sd: StreamDescriptor, timeout: Milliseconds]
RETURNS [cc: CompletionCode];
GetPutTimeout:
PROC [sd: StreamDescriptor]
RETURNS [cc: CompletionCode, timeout: Milliseconds];
Send blocks until all data has been written, or until timeout.
SendAttn: PROC [sd: StreamDescriptor, attnType: AttnType]
RETURNS [cc: CompletionCode];
Receive: UNSAFE PROC [sd: StreamDescriptor, block: IO.UnsafeBlock]
RETURNS [cc: CompletionCode, nBytesReceived: INT];
SetGetTimeout: PROC [sd: StreamDescriptor, timeout: Milliseconds]
RETURNS [cc: CompletionCode];
GetGetTimeout:
PROC [sd: StreamDescriptor]
RETURNS [cc: CompletionCode, timeout: Milliseconds];
Receive blocks until it can return at least one byte of data, or until timeout.
A single receive won't cross an in-band attention that has been waited for using WaitOOBAttn.
InputReady:
PROC [sd: StreamDescriptor, wait:
BOOL ¬
FALSE]
RETURNS [cc: CompletionCode, inputReady:
BOOL];
WaitOOBAttn:
PROC [sd: StreamDescriptor, timeout: Milliseconds]
RETURNS [cc: CompletionCode, attnType: AttnType];
AtIBAttn: PROC [sd: StreamDescriptor]
RETURNS [cc: CompletionCode, atIBAttn: BOOL];
Listener Operations
CreateListenerDescriptor:
PROC [local:
ROPE ¬
NIL]
RETURNS [cc: CompletionCode, ld: ListenerDescriptor];
DestroyListenerDescriptor:
PROC [ld: ListenerDescriptor]
RETURNS [cc: CompletionCode];
AddressFromListenerDescriptor: PROC [ld: ListenerDescriptor]
RETURNS [cc: CompletionCode, local: ROPE];
AcceptConnection: PROC [ld: ListenerDescriptor]
RETURNS [cc: CompletionCode, sd: StreamDescriptor];
}.