AgNet - silverware Networking Interface Kit

by silver Harloe

Doc Index

Design Overview

Here's how AgNet might be used in the prototypical chat application:

[overview image]
As you can see, the idea is that AgNet provides a multiplexer and one or more listener programs which know how to handle users of various types. Your server need not be aware of the listener type. Thus if we add a new listener type which is of use to you, you can offer it without changing server code. Also, the server is not made aware of listeners directly - the server does not know how many or what kind of listeners are running.

Communication between the users and the listeners is in whatever native format is needed by their client (the program 'telnet' is just a client which happens to use the telnet protocol). Communication between the listeners and multiplexer, and the between the multiplexer and server, is mediated by 'messages'. Messages provide control signals, but the messages of greatest concern to you are the ones which relay user input or server output.

On the server, each user is referred to by a 'client key'. While the client key could be read to to determine the path to the client (and thus infer information about listeners), the best use of the client key is just to turn it into a string which can be used as a unique hash-key to keep track of the user. The client key is already abstracted to take care of the future potential of 'chaining' multiplexers.

Of course, AgNet is configurable, so even if you are running a game server which requires some kind of graphical client to connect to it, you could simply run only 'tcp listeners' in 'raw binary' mode and take your user potential from whatever is configured in your OS up to 57600 (240 listeners with 240 users each). This brings your game near MMORPG potential in size, but without your having to change much code at all (the client would not even aware of the relaying through AgNet).

[dedicated client config]
Of course, you'd still have to deal with the issues of server load and speed, but you could configure AgNet to allow a lesser number of users until your hardware and bandwidth could match.

One of the other advantages you'd gain is the ability to restart your server without disconnecting clients - AgNet can save almost 4k of data per user (that may not seem like enough for a game, but remember you could be saving a database key).

Overall, it's a fairly simple design, and it was programmable in under ten thousand lines of code, but it's one of those wheels that gets reinvented over and over. My goal is no less than having AgNet be the 'Apache' of connection-oriented, non-threading servers.

Doc Index

This project is hosted by Logo project homepage silver's homepage