The Unix Internet daemon manager, inetd, implemented in Frontier.
This is cooool!
I was talking with Chuck about higher level interfaces for server-writing in Frontier and he suggested we look at something like the inetd app on Unix. I asked why we don't just implement inetd. So that's what we did.
Download
First, download the NetEvents app and its support files from the TCP Scripting page. Then download the inetd package from:
ftp://ftp.scripting.com/userland/inetd.sit.hqx
Double-click on each of the Frontier files in the folder, click on OK to all confirmation prompts.
Writing a server daemon
Look in the user.inetd.config table. There's one sub-table as we ship it called http. When you want to write another server, copy/paste the table and change the daemon script and the other info in the table.
There are three cells in each table. Count is the number of listeners you want for this daemon, the number of simultaneous active connections. Port is the port number that this daemon will be listening on, and daemon is the script that implements the server.
Every daemon script has a common header. Its name must be daemon and it takes a single parameter, the address of a table with parameters for an incoming request. There's a comment at the head of the sample daemon that says what all the table elements are, the two you're likely to use are "stream" which is the stream identifier for the request, and client, which is a 4-byte encoded version of the IP address of the client machine.
You can call netEvents.readStream or netEvents.writeStream or netEvents.statusStream in your daemon script. Don't close the stream, the inetd framework does that for you automatically.
This is a new framework, so its interfaces are still subject to change.
Starting up the servers
To start up your inetd servers, run this script: inetd.startup (). You can put a call to this script in your system.startup table, or link it to a menu command, or while you're testing, just run the script from the script editing window.
Sun, Feb 16, 1997 at 6:06:39 AM by DW
© Copyright 1996-97 UserLand Software. This page was last built on 5/7/97; 1:20:44 PM.
It was originally posted on 2/16/97; 5:51:26 AM.
Internet service provided by Conxion.