Galaxy Communicator Documentation:

Main loop example


In this example, we show how the Communicator main loop works, and how to recreate Communicator server functionality in other main loops.

This example can be found in the distribution in contrib/MITRE/examples/simple_mainloop.

Source files

simple_mainloop.c: provides a crude main loop for illustration purposes, which allows the user to set callbacks on file descriptors and on "timers" (actually, loop iterations, but it serves the purpose). This file defines the functions SM_AddTimerCallback, SM_RemoveTimerCallback, SM_AddFDCallback, SM_RemoveFDCallback, and SM_Mainloop ("SM" stands for "simple mainloop").

simple_mainloop_elr.c: uses this crude mainloop to run a Communicator-compliant server.

mainloop_double.c: the standard double server from the double example, using simple_mainloop_elr.c.

basic_double.c: a double server with an explicit main loop (essentially a copy of the one in the GalaxyCommunicator core library), to contrast with the other servers in this example.

Scripts

mainloop_double.csh: runs the mainloop_double server and the Hub, using the double program file from the double example.

mainloop_audio.csh: runs the mainloop_testaudio_send and mainloop_testaudio_receive servers and the Hub, using the audio program file from the audio example.

basic_double.csh: runs the basic double server and the Hub, using the double program file from the double example.

Compilation

Typing "make" in this directory will create the servers, MIT-style Makefiles, and scripts.

Discussion

See the documentation on server structure and alternative main loops.


Please send comments and suggestions to:bugs-darpacomm@linus.mitre.org
Last updated June 5, 2001.

 Copyright (c) 1998 - 2001
The MITRE Corporation
ALL RIGHTS RESERVED