-
class
ReflectServer
(Return to index)
-
This class represents a reflection server: It runs on a centrally located machine,and many clients may connect to it simultaneously. This server can then redirect messagesuploaded by any client to other clients in a somewhat efficient manner.
Type:
Include file:
../../reflector/ReflectServer.h
Synopsis:
Public methods:
- public virtual void
Cleanup ()
Should be called just before the ReflectServer is to be destroyed.
this in a good place to put any cleanup code. Be sure
to call Cleanup() of your parent class as well!
(We can't just do this in the destructor, as some cleanup
relies on the subclass still being functional, which it isn't
when our destructor gets called!)
- public virtual status_t
ReadyToRun ()
Called after the server is set up, but just before accepting any connections.
Should return B_NO_ERROR if it's okay to continue, or B_ERROR to abort.
Default implementation returns B_NO_ERROR.
- public
ReflectServer ()
- public virtual status_t
ServerProcessLoop (ReflectSessionFactoryFunc createSessionFunc, short acceptPort = 2960)
The main loop for the message reflection server.
Returns B_ERROR if there was a problem setting up. This method will not return until the server stops running (usually due to an error)
(acceptPort) is the port the server will listen on.
(createSessionFunc) should be a function of the form:
AbstractReflectSession * MyFunc();
that returns a new AbstractReflectSession object to be used for communicating with
the given socket. The object this function returns determines the semantics of the server.
Most non-abstract ReflectSession classes come with such a function.
- public
~ReflectServer ()
Protected methods:
Friend methods: