pclient.C

Go to the documentation of this file.
00001 void pclient(int niter = 100, int bsize = 500000, int nsocks = 5)
00002 {
00003    // Client program to test parallel sockets.
00004    //
00005    // To run this demo do the following:
00006    //   - Open two windows
00007    //   - Start ROOT in all two windows
00008    //   - Execute in the first window: .x pserv.C
00009    //   - Execute in the second window: .x pclient.C
00010    // If you want to run the pserv.C on a different host, just change
00011    // "localhost" in the TPSocket ctor below to the desried hostname.
00012    //Author: Fons Rademakers
00013    
00014    // Open connection to server
00015    TPSocket *sock = new TPSocket("localhost", 9090, nsocks);
00016    //TPSocket *sock = new TPSocket("pcroot2", 9090, nsocks);
00017 
00018    char *buf = new char[bsize];
00019    memset(buf, 65, bsize);
00020 
00021    sock->Send(niter, bsize);
00022 
00023    // send data to server
00024    for (int i = 0; i < niter; i++) {
00025       int ret = sock->SendRaw(buf, bsize);
00026       if (ret < 0) {
00027          printf("error sending\n");
00028          break;
00029       }
00030    }
00031 
00032    delete sock;
00033    delete [] buf;
00034 }

Generated on Tue Jul 5 15:44:52 2011 for ROOT_528-00b_version by  doxygen 1.5.1