<brazen preannouncement>
I'm finishing up a file server for NadaNet that is written in
Applesoft BASIC running under ProDOS, in less than 300 lines,
with Applesoft client-side code of about 15 lines. ;-)
It handles all the BASIC.SYSTEM commands that make sense from a
remote machine (BSAVE, BLOAD, BRUN, SAVE, RUN, CREATE, DELETE,
LOCK, UNLOCK, RENAME, and VERIFY), with all the legal parameters.
After each command is completed by the server, it posts to the
client the result code (with error code, if any), the AUX TYPE,
and the EOF of the file if data was transferred.
This allows any machine on a NadaNet to use the filesystem on the
server using an invoking interface like:
RQ$ = "bload myprog,a$2000":gosub 10000
Of course, the request string can be formed by concatenating
any variable parameter values, etc., as desired.
Errors can be handled in-line by setting EH=1 prior to the GOSUB
and then examining the value of RC after the GOSUB. (If EH=0, then
any error results in an error message and a STOP.)
The current implementation is geared to a network of more than two
machines, and uses a message server to queue the requests. The server
and client code are easily modified for a two-machine network that
forgoes queueing (since one client can't have more than one request
in the queue at a time anyway) and so doesn't need the message server.
The client machine queues a request (prefixed with its machine ID)
by doing a &PUTMSG to the predetermined file server queue number, then
idles in a &SERVE() loop polling the result code after each network
transaction handled by the client. When it finds a result, it returns
from the GOSUB and continues execution.
The file server idles polling its input queue with a &GETMSG, and, when
it finds a request, it parses it, sets up any required parameters that
were not supplied, and executes the command on the local file system.
If a data transfer is required, it is &PEEKed and BSAVEd or BLOADed and
&POKEd in chunks up to some maximum (like 4KB, to keep network latency
reasonable). When the command is complete, the result code, and any
address and EOF information, is &POKEd to the requester, and the server
goes on to the next request in its queue.
Performance seems to be quite good, limited primarily by device latency
and/or network bandwidth (>10KB/sec).