ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
pclient.C
Go to the documentation of this file.
1 void pclient(int niter = 100, int bsize = 500000, int nsocks = 5)
2 {
3  // Client program to test parallel sockets.
4  //
5  // To run this demo do the following:
6  // - Open two windows
7  // - Start ROOT in all two windows
8  // - Execute in the first window: .x pserv.C
9  // - Execute in the second window: .x pclient.C
10  // If you want to run the pserv.C on a different host, just change
11  // "localhost" in the TPSocket ctor below to the desried hostname.
12  //Author: Fons Rademakers
13 
14  // Open connection to server
15  TPSocket *sock = new TPSocket("localhost", 9090, nsocks);
16  //TPSocket *sock = new TPSocket("pcroot2", 9090, nsocks);
17 
18  char *buf = new char[bsize];
19  memset(buf, 65, bsize);
20 
21  sock->Send(niter, bsize);
22 
23  // send data to server
24  for (int i = 0; i < niter; i++) {
25  int ret = sock->SendRaw(buf, bsize);
26  if (ret < 0) {
27  printf("error sending\n");
28  break;
29  }
30  }
31 
32  delete sock;
33  delete [] buf;
34 }
Int_t Send(const TMessage &mess)
Send a TMessage object.
Definition: TPSocket.cxx:492
Int_t bsize[]
Definition: SparseFit4.cxx:31
Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt)
Send a raw buffer of specified length.
Definition: TPSocket.cxx:554
void pclient(int niter=100, int bsize=500000, int nsocks=5)
Definition: pclient.C:1
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)