Server program to test parallel sockets.
To run this demo do the following:
- Open two windows
- Start ROOT in all two windows
- Execute in the first window: .x pserv.C
- Execute in the second window: .x pclient.C
void pserv()
{
delete ss;
int niter, bsize;
sock->
Recv(niter, bsize);
printf("Receive %d buffers of %d bytes over %d parallel sockets...\n",
char *buf = new char[bsize];
for (int i = 0; i < niter; i++) {
memset(buf, 0, bsize);
int ret = sock->
RecvRaw(buf, bsize);
if (ret < 0) {
printf("error receiving\n");
break;
}
if (buf[0] != 65) {
printf("received data corrupted\n");
break;
}
}
delete sock;
delete [] buf;
printf("%d bytes received in %f seconds\n", niter*bsize, rtime);
if (rtime > 0) printf(
"%5.2f MB/s\n",
Double_t(niter*bsize/1024/1024)/rtime);
}
virtual TSocket * Accept(UChar_t Opt=kSrvNoAuth)
Accept a connection on a parallel server socket.
Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt)
Send a raw buffer of specified length.
Int_t Recv(TMessage *&mess)
Receive a TMessage object.
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
void Stop()
Stop the stopwatch.
- Author
- Fons Rademakers
Definition in file pserv.C.