This class is used to instantiate a small database server. It is designed to handle small datasets. Once the server is set up using the init() method, it can be used to handle connections and process incoming requests using the process() method. This class also provides functions to display performance statistics.
Clients which are created using this class can connect to the server set
up using QUANTAdb_server_c class. The client can perform commands like
put(),
fetch()
and commit()
or remoteCommit()
(for the server database). The process()
method is used to keep the client running and handle messages and reconnect()
is used to connect back to the server if the connection is broken. The
trigger()
method is used to execute a user defined function each time a data arrives
(in client.cxx the user defined function is incomingData() ). This is the
traditional way of firing a callback.
QUANTAmisc_observer_c and QUANTAmisc_subject_c
These classes are used to implement the Observer/Subject technique - we do not instantiate this class, but the we create a 'myObserver' class (see client.cxx) which inherits from the QUANTAmisc_observer_c class and overload the update() function. The myObserver object is attached to the client using the attach() method and each time the notify() method is called the update() method is executed. All clients are then informed about the last update made.
2. To run a client
client
<server-address>
If another client is connected to the server, then a similar message is relayed to all the clients. You can check if the message 'hello' was inserted into the server database.
for more information: Post your questions online at Quanta forum