home *** CD-ROM | disk | FTP | other *** search
-
- HOW TO WRITE SERVER PROGRAMS
-
- SERVERS are run on demand by the DNET device driver. This is
- accomplished by DNET doing a LoadSeg() and CreatProc(). The server
- CANNOT GO THROUGH A NORMAL STARTUP for several reasons:
-
- (1) There is no CLI and the message passed over the process
- port is DNET specific (NOT a workbench message)
-
- (2) Registers contain garbage (no argument line)
-
- (3) No standard file handles exist
-
-
- For AZTEC C, this is accomplished by overiding the standard _main with
- your own. You must then setup the listen port and wait/reply the startup
- message from DNET. See the source (for example, SERVER/STERM.C) for
- an example.
-
- The server can exit at any time after it DUnListen()'s the port. Multiple
- DNET's will all use the same server for a specific port #.
-
- _main()
- {
- struct Message *msg;
- long mask, pmask, hdmask;
- PROC *proc = FindTask(NULL);
-
- Enable_Abort = 0;
- LisPort= DListen(PORT_IALPHATERM);
- WaitPort(&proc->pr_MsgPort);
- ReplyMsg(GetMsg(&proc->pr_MsgPort));
- if (!LisPort)
- exit(1);
-
- ...
-