fdhwlib
2.0.25
|
#include <simpleserver.h>
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.
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:
Definition at line 61 of file simpleserver.h.
SimpleServer::SimpleServer | ( | unsigned short | port | ) |
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:
Reimplemented from BaseServer.
Reimplemented in GpsServer, and EventLoopClient.