Why is this faster than a single socket connection? The TCP protocol requires acknowledgement from the other end everytime it sends a packet, thus it waits for someting on every send. With parallel sockets, while one socket is waiting, another socket connection can send data. We therefore eliminate idle time.
If you are writing a server you need to instantiate a QUANTAnet_parallelTcpServer_c
object. Likewise if you are writing a client you need to instantiate a
QUANTAnet_parallelTcpClient_c object.
This class can be used to instantiate a TCP server. 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_parallelTcpServer_c class using connectToServer(Machine name, Port Number, NumberofSockets). The clients can carry out read() and write() operations.
2. To run a client
client
<remote host> <remote port> <psocket size> <send buffer size>
example:
client turing 9012 10 512
At server side :
Total bytes received: 512
Approx Elapsed Seconds = 0.014545
Done!
for more information: Post your questions online on the Quanta forum page.