fdhwlib  2.0.25
SimpleServer Class Reference

#include <simpleserver.h>

Inheritance diagram for SimpleServer:
BaseServer EventLoop GpsServer TsBackgroundLoop EventLoopClient FEEventLoop KaEventLoop

List of all members.

Public Member Functions

Protected Member Functions


Detailed Description

Implements a simple IP server.

The server waits for connections. The communication with the client is defined in the protected function read_from_client. Overload this function for a specific application.

The SimpleServer automatically detects the byte order of the client process and transfers all data in client byte order.

Todo:

Use a independant threads for all connections. If one connection hangs, the other won't be affected?!

Improve the Server managment. Loging, Shutdown via IP. For some other purpose a New class similar to Pbus/PbusProxy couble may be useful for mainanace and run control. Eg. Shutdown + restart of the Server, Control of the IRdispatcher!!!

Changes:

  • 30.8.05 ak: Detect client byte order
  • 4.11.02 ak: Add stdin to the select functions. The server is now responding to socket and keyboard input! Improved output of the server - format similar to that of netstat --ip.
  • 31.10.02 ak: Closing all connected sockets before shutdown. This prevents hanging connections after terminating the server.
  • 18.3.01 ak: Protected variable for the output stream introduced - stop this nasty messages in the terminal!!!

Definition at line 61 of file simpleserver.h.


Constructor & Destructor Documentation

SimpleServer::SimpleServer ( unsigned short  port)

Member Function Documentation

virtual void SimpleServer::executeCmd ( int  client,
short  cmd,
unsigned int *  arg,
short  n 
) [protected, virtual]

Execute a command - The instruction set on the client side remoteCall needs to fit to this implementation.

Reimplemented in GpsServer, and TsBackgroundLoop.

virtual void SimpleServer::executeCmd ( int  client,
short  cmd,
unsigned long *  arg,
short  n 
) [protected, virtual]

Reimplemented in TsBackgroundLoop, and EventLoop.

virtual int SimpleServer::read_from_client ( int  filedes) [protected, virtual]

Defines the interface from the communication with the proxy process.

The function is able to detect if the client uses a different byte order and automatically re-orders the data. All following communication will be swapped to have the appropriate byte order.

The protocol is defined as follows:

  • command (4 bytes)
  • len (4 bytes)
  • data (len * 4bytes)

Reimplemented from BaseServer.

Reimplemented in GpsServer, and EventLoopClient.


The documentation for this class was generated from the following file: