Visit the official site at http://www.croco.net/software/sue
Simple Unix Events (SUE) Library is a small and light-weight set of C++ classes which lets you easily create an event-driven application with C++ under Unix.
There are three types of events SUE can let you handle:
First of all, you'll need one (and, likely, only one) object of the SUEEventSelector class. This object will be the heart of your application. In fact, you will always need an access to the object so you can consider making it a global variable. Another (and better) way is to create the object once and then pass its address to all your subsystems so that they can access it. Personally I prefer never never never ever use global variables, just as a matter of style.
SUEEventSelector provides the Go() method which will be the main loop of your application.
In order to handle some events, you'll need the following classes:
Besides the basic event handling classes, the library includes some support for higher level abstractions such as TCP sessions.
Take a look at the following classes:
It is well-known that the best way to learn something is to look at a good example and try to repeat it. Here are some working demo programs which come along with the library.
The example sleep5.cpp is perhaps the simplest event-driven application ever made. It is intended to give you the basic idea how to work with SUEEventSelector and its company.
Another example, sitter.cpp, is probably more interesting for you because it uses two different types of events. First, it uses timeouts, just like the previous one (but it changes the moment from time to time). Second, it handles the event of arriving data on the standard input.
Yet another example, chat.cpp, is a very simple sample of a multiclient TCP server. It is a chat room. You can learn how to use the SUETcpServer and SUETcpServerSession classes (or, more precisely, how to create appropriate childern of them and use the children, not the classes themselves).
Well if you need to make your application to work as a TCP client rather than server (or even a client to one and server to another), take a look at hellobot.cpp, which demonstrates the SUETcpClientSession class. It is a bot for the previous example. The bot connects to the server and greets everyone who joins the chat room.
The last two sample programs are sigs.cpp and children.cpp; they are to give you an idea on handling unix signals (and, as a special case, the SIGCHLD signal) with SUE.