home *** CD-ROM | disk | FTP | other *** search
-
- DNET LINK LIBRARY
-
- Link with your server's and client programs.
-
-
- listenport = DListen(port#) listen for connections
- chanport = DAccept(listenport) accept a new connection
- DNAAccept(listenport) or refuse a new connection
- chanport = DOpen(host, port#, txpri, rxpri) open a new channel
- DPri(chanport, priority) (not implemented yet)
- act = DNRead(chanport, buf, bytes) (see below)
- act = DRead(chanport, buf, bytes) (see below)
- act = DWrite(chanport, buf, bytes) act = -1 or bytes
- DEof(chanport) send eof (amiga<>amiga only)
- DQueue(chanport, maxq) set asynchronous queue write
- queue size (default 0)
- DClose(chanport) close a channel
- DUnListen(listenport) stop listening on a channel
-
- DQuit(host) cause remote end to quit out
- of the DNET protocol.
-
- General notes:
- The calls have a notion of ownership. The task which created
- the listen port or openned the channel owns it. Foreign tasks
- may DAccept() connections on somebody elses listen port (i.e.
- your server creates a task to handle the accept). In fact, this
- is the only way you can spawn off tasks to handle new connections
- as only the owner of a channel (caller of DAccept()/DOpen()) may
- use the channel.
-
- The calls are not extremely efficient at the momement, but since
- the network, by virtue of being on a serial line, is so slow,
- it doesn't really matter.
-
- You are guarenteed a signal will be present whenever there is
- pending data, even if you only partially read what is available.
- NOTE that you *will* get signals sometimes even when no data is
- available, and should thus take into account DNRead() returning
- 0... Usually DNRead() is used in conjuction with Wait()ing on
- the signal bit of the channel port.
-
- DEOF()
-
- Eof a channel. Implemented ONLY for the Amiga. You cannot EOF
- a channel if running between the Amiga and a UNIX machine. This
- is essentially an unsupported call, and you should use DCLose()
- to close(and send an eof) on a channel. The network handles it
- just fine, but the UNIX side has no way of sending an EOF over
- a socket without closing the socket.
-
- DLISTEN()
-
- This call listens on a virtual port # (0-65535) for connections
- from a remote host. NULL is returned if the port is already
- being listened on by somebody else.
-
- DACCEPT()
-
- Accepts connections over a virtual port #. Several connections
- may be accepted and worked on simultaniously. NULL is returned if
- there are no pending connections. You can WaitPort() on the
- listenport to wait for new connections, but should note that
- even after a WaitPort(), DAccept() might return NULL every
- once in a while.
-
- DAccept() will set the signal bit associated with the port if
- further connections are pending.
-
- DNAACCEPT()
-
- Don't accept connections over a virtual port #. If there is a
- connection pending, it will return an error on the other end.
- Returns 1 if a connection was refused, 0 if there were no
- pending connections.
-
- DUNLISTEN()
-
- Stop listening on a virtual port #. Any pending requests are
- automatically DNAAccept()ed.
-
- DPRI()
-
- Set the priority of a channel (-128 lowest to 127 highest).
- The priority only effects throughput when two or more channels
- at different priorities are transfering data at the same time.
-
- Not currently implemented.. priority is what you set in DOpen()
-
- DNREAD()
-
- Read data from a channel. 0 is a valid return value, meaning that
- no data is currently ready to read. You can WaitPort() on the
- channel port to wait for data (or EOF). A negative value is
- returned on EOF or failure.
-
- error codes:
- -1 EOF on channel
- -2 Remote end CLOSED the channel (not implemented)
-
- DREAD()
-
- Read data from a channel. The number of bytes requested are
- returned, unless the other end closed it's side in which case
- fewer than the number of bytes requested will be returned. That
- is, this call will BLOCK waiting for data.
-
- A negative value is returned on EOF or failure.
-
-
- DWRITE()
-
- Write data to a channel. The return value is either the # bytes
- written, or a negative error code.
-
- -1 Remote end REOF'd the channel
- -2 Remote end CLOSED the channel
-
- note: not much distinction between the two
- currently.
-
- DCLOSE()
-
- Close a channel.
-
- DOPEN()
-
- Application side OPEN().... Open a port# on a remote host. Returns
- a channel port or NULL. Two priorities are given. Each may be
- in the range (lowest) -127 to 126 (highest) inclusive. The first
- priority is for transmitting data client->server, the second
- for receiving data server->client.
-
- The host field should be NULL for now. In future versions, you
- will be able to run multiple DNET's on your Amiga and this will
- field will determine which one you are attempting to connect
- through.
-
- DQUIT()
-
- Causes DNET on the remote side to quit out. If running on a
- 4.2BSD UNIX machine, the DNET will exit. If running on another
- Amiga, the DNET will return to terminal-window mode.
-
- The host has the same definition as for DOpen().
-
-
-
-