Search blog.co.uk

About me

tibbar

tibbar

Calendar

<<  <  October 2006  >  >>
Mo Tu We Th Fr Sa Su
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          

Last comments

Archives for: October 2006, 19

linux server framework

by tibbar @ 2006-10-19 - 23:13:23

hmm here's my first linux project, a c++ framework for developing server apps.

You can inherit from CGenericServer and override the following virtual functions:

virtual void ProcessCommand(char* buf, int clientNumber);
virtual bool Authenticate(int clientNumber);

a simple example is shown via the class CBackdoor that illustrates how you can implement authentication and override the default command processing (by default it will allow commands "quit" and "shutdown").

In GenericServer.h the preprocessor:

#define MAX_CLIENTS 3

is used to specify the max number of concurrent connections. Beyond this connections will be rejected until the queue shortens.

It's pretty simple and easily extended. I might consider adding a LINUX / WIN32 preprocessor and possibly even port it to windows kernel mode (as in the kernel ircbot).

If I do this, it will allow kernel mode servers to be written with ease.

Useful additions to the base class might be BinaryTransferSend/Recieve(char* filename) and probably a load of other stuff i can't think of right now.

It's built under KDevelop, but i guess you can compile from command line using gcc if you don't like this.

You can download it here:

GenericServerFramework


 
 

Footer

The content of this website belongs to a private person, blog.co.uk is not responsible for the content of this website.