ð? Syntax14b.Scn.Fnt2Syntax10.Scn.FntÊSyntax10b.Scn.Fnt Syntax10i.Scn.Fnt     %<îÿÿÿ £Zà¥ParcElemsAlloc€å áá ¼ýn < ? /ƒ ðÿÿÿ £ZॠÆê ¼ý Qåÿÿÿ £Z˜StyleElemsAllocà•À°ÒðÈýIndentedB   ðÿÿÿ £ZॠÆê ¼ý  åÿÿÿ £Z˜à•À°ÒðÈýIndented-ðÿÿÿ £ZॠÆê ¼ý 1åÿÿÿ £Z˜à•À°ÒðÈýIndented 7  ðÿÿÿ £ZॠÆê ¼ý åÿÿÿ £Z˜à•À°ÒðÈýIndented 6îÿÿÿ £Zीå áá ¼ý . R R T \Xðÿÿÿ £ZॠÆê ¼ý håÿÿÿ £Z˜à•À°ÒðÈýIndented* P\Cðÿÿÿ £ZॠÆê ¼ý  åÿÿÿ £Z˜à•À°ÒðÈýIndented0ðÿÿÿ £ZॠÆê ¼ý  åÿÿÿ £Z˜à•À°ÒðÈýIndented0ðÿÿÿ £ZॠÆê ¼ý  åÿÿÿ £Z˜à•À°ÒðÈýIndentedðÿÿÿ £ZॠÆê ¼ý  åÿÿÿ £Z˜à•À°ÒðÈýIndentedðÿÿÿ £ZॠÆê ¼ý åÿÿÿ £Z˜à•À°ÒðÈýIndented (ðÿÿÿ £ZॠÆê ¼ý  @åÿÿÿ £Z˜à•À°ÒðÈýIndented0ðÿÿÿ £ZॠÆê ¼ý  Iåÿÿÿ £Z˜à•À°ÒðÈýIndentedBðÿÿÿ £ZॠÆê ¼ý  +åÿÿÿ £Z˜à•À°ÒðÈýIndentedðÿÿÿ £ZॠÆê ¼ý 'åÿÿÿ £Z˜à•À°ÒðÈýIndented/ðÿÿÿ £ZॠÆê ¼ý0éÿÿÿ £ZॠÆê ¼ý ã€¨Æ bðÿÿÿ £ZॠÆê ¼ý 1 M--* .) 3.- I) ( $ *% / ðÿÿÿ £ZॠÆê ¼ý  "åÿÿÿ £Z˜à•À°ÒðÈýIndented&ðÿÿÿ £ZॠÆê ¼ý Båÿÿÿ £Z˜à•À°ÒðÈýIndentedAðÿÿÿ £ZॠÆê ¼ý œ A Portable and Simple Oberon Interface to TCP/IP (3.7.1996) Module TCP is a simple, synchronous interface to the TCP/IP protocol. It allows to implement Oberon TCP/IP clients and servers. This document describes the standard interface. DEFINITION TCP; IMPORT SYSTEM; CONST Done = 0; NotDone = 1; Timeout = 2; LocalPortInUse = 3; (* result codes for Connect *) AnyPort = 0; AnyAdr = 0; (* can be passed to lport in Connect *) TYPE Listener = POINTER TO ListenerDesc; Connection = POINTER TO ConnectionDesc; ConnectionDesc = RECORD id-: LONGINT END; IpAdr = LONGINT; VAR res: INTEGER; (* Done or NotDone, set to indicate errors for ReadX and WriteX *) Listener Servers use a listener object to listen on a specific port number. A listener is initialized and started with Listen. The server subsequently uses Requested to determine if a client wishes to connect to the port. If Requested(L) is TRUE, the server accepts the connection request by calling Accept(L, C). After accepting a connection on the listener L, the listener keeps listening for new connection requests. The server stops a listener object from listening to a port by calling Close(L).  PROCEDURE Listen (L: Listener; lport: INTEGER; radr: LONGINT; rport: INTEGER; VAR res: INTEGER); Listens for incoming connection requests on the local port number lport. Only connection requests from radr and rport will be accepted. radr may be AnyAdr, rport may be AnyPort. lport must not be AnyPort. If the local port number lport is already in use, res is set to LocalPortInUse.  PROCEDURE Requested (L: Listener): BOOLEAN; TRUE if the listener L detected a connection request on its port.  PROCEDURE Accept (L: Listener; C: Connection; VAR res: INTEGER); If Requested(L), Accept opens connection C to the peer making a connection request. Blocks until Requested(L) holds.  PROCEDURE Close (L: Listener); Listener L stops listening to its port and releases the port. Connection Connections are opened with Connect. Reading and writing operations are blocking. Available returns the number of bytes that can be read from a connection without blocking. AvailToSend returns the number of bytes that can be sent over a connection without blocking. Connected is TRUE as long as data can be sent over a connection. A connection is closed with Disconnect. A connection has an associated id number that can be used to refer to a connection (field id). ThisConnection maps id numbers to connection objects. Clients that use Oberon tasks should store the connection id in the task, rather than the connection object proper, to give the garbage collector a chance to collect and possibly finalize connections. It is guaranteed that the same ID is never allocated for two different connections during one session.  PROCEDURE Connect (C: Connection; lport: INTEGER; Adr: IPAddress; rport: INTEGER; timeout: LONGINT; VAR res: INTEGER); Opens a connection specified by the pair (Adr, rport). If the connection is not accepted after timeout milliseconds, the result code Timeout is returned in res. If timeout = 0, a default timeout is used. If a specific local port is desired, it can be specified in lport. Using AnyPort for lport means that no special port number is desired for the local port.  PROCEDURE Available (C: Connection): LONGINT; returns the number of bytes that can be read on C without blocking.  PROCEDURE AvailToSend (C: Connection): LONGINT; returns the number of bytes that can be sent on C without blocking.  PROCEDURE Connected (C: Connection): BOOLEAN; Returns TRUE if the connection C is writeable.  PROCEDURE Disconnect (C: Connection); Closes an open connection.  PROCEDURE ThisConnection (id: LONGINT): Connection; Returns connection with C.id = id, or NIL if no such connection exists.  PROCEDURE HostByName (hostname: ARRAY OF CHAR; VAR adr: LONGINT; VAR res: INTEGER); Given a hostname, the IP address of that machine is returned in adr.  PROCEDURE HostByNumber (number: ARRAY OF CHAR; VAR adr: LONGINT; VAR res: INTEGER): IPAddress; Converts an IP-Number string in dot-notation into an IP address.  PROCEDURE GetHostName (VAR s: ARRAY OF CHAR; VAR res: INTEGER); Returns the local hostname.  PROCEDURE GetHostAddress (VAR adr: LONGINT; VAR res: INTEGER); Returns the IP address of the local machine.  Data formats for interpreted data exchange are  Type Format INTEGER two bytes, network byte ordering LONGINT four bytes, network byte ordering REAL four bytes, IEEE single precision LONGREAL eight bytes, IEEE double precision SET four bytes, SYSTEM.VAL(LONGINT, {0}) = 1 BOOLEAN one byte Network byte ordering is big endian (like used on PowerMac, HP; not little endian as used on SPARC and Intel 80x86).  PROCEDURE Read (C: Connection; VAR x: SYSTEM.BYTE); PROCEDURE ReadBytes (C: Connection; VAR x: ARRAY OF SYSTEM.BYTE; beg, len: LONGINT); PROCEDURE ReadInt (C: Connection; VAR x: INTEGER); PROCEDURE ReadLInt (C: Connection; VAR x: LONGINT); PROCEDURE ReadReal (C: Connection; VAR r: REAL); PROCEDURE ReadLReal (C: Connection; VAR r: LONGREAL); PROCEDURE ReadSet (C: Connection; VAR s: SET); PROCEDURE ReadString (C: Connection; VAR s: ARRAY OF CHAR); PROCEDURE ReadBool (C: Connection; VAR b: BOOLEAN); PROCEDURE Write (C: Connection; x: SYSTEM.BYTE); PROCEDURE WriteBytes (C: Connection; x: ARRAY OF SYSTEM.BYTE; beg, len: LONGINT); PROCEDURE WriteInt (C: Connection; x: INTEGER); PROCEDURE WriteLInt (C: Connection; x: LONGINT); PROCEDURE WriteReal (C: Connection; r: REAL); PROCEDURE WriteLReal (C: Connection; r: LONGREAL); PROCEDURE WriteSet (C: Connection; s: SET); PROCEDURE WriteString (C: Connection; s: ARRAY OF CHAR); PROCEDURE WriteBool (C: Connection; b: BOOLEAN);  PROCEDURE WriteUrgent (C: Connection; x: SYSTEM.BYTE); Sends a byte with the urgent bit set.  PROCEDURE WriteBytesUrgent (C: Connection; VAR x: ARRAY OF SYSTEM.BYTE; beg, len: LONGINT); Sends the bytes x[beg] .. x[beg+len-1] with the urgent bit set. END TCP.