QUANTA provides users direct control of lower level tcp socket calls.
A server can be set up using this class. The port number on which the server is to be opened is given to the init() method. After this we can use the checkForNewConnections() method to look for incoming client connections.
A client can be created using this class. It can connect to the server
set up using QUANTAnet_tcpServer_c class using connectToServer().
The clients can carry out read()
and write()
operations in the blocking or non blocking mode. If the non blocking mode
is being used the isReady(),
isReadyToRead(),
isReadyToWrite()
methods may be useful. You can also change the timeout values for the blocking
mode by using setTimeOut()
.
Performance measuring methods are also available and the showStats()
method should be typically executed after a read/write is done over a network.
The server.cxx program in the demo sets up a TCP server and the client.cxx
program runs a client which connects to the server. The client sends a
message 'TICK(number of time intervals)' in every time interval and sends
an 'UPDATE' message every ten time intervals. When the server receives
the 'UPDATE' message it broadcasts the data in it's buffers to all the
clients. This demos allows 10 clients to connect to the server.
2. To run a client
clienttcp <server-address>
Performance measuring
statistics are also displayed.
for more information: Post your questions online on the Quanta forum page.