ROOT
6.10/00
Reference Guide
ROOT Home Page
Main Page
Tutorials
User's Classes
Namespaces
All Classes
Files
Release Notes
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
tutorials
net
pclient.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_net
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 desired hostname.
12
///
13
/// \macro_code
14
///
15
/// \author Fons Rademakers
16
17
void
pclient(
int
niter = 100,
int
bsize
= 500000,
int
nsocks = 5)
18
{
19
// Open connection to server
20
TPSocket
*sock =
new
TPSocket
(
"localhost"
, 9090, nsocks);
21
//TPSocket *sock = new TPSocket("pcroot2", 9090, nsocks);
22
23
char
*buf =
new
char
[
bsize
];
24
memset(buf, 65,
bsize
);
25
26
sock->
Send
(niter,
bsize
);
27
28
// send data to server
29
for
(
int
i = 0; i < niter; i++) {
30
int
ret = sock->
SendRaw
(buf,
bsize
);
31
if
(ret < 0) {
32
printf(
"error sending\n"
);
33
break
;
34
}
35
}
36
37
delete
sock;
38
delete
[] buf;
39
}
TPSocket::Send
Int_t Send(const TMessage &mess)
Send a TMessage object.
Definition:
TPSocket.cxx:492
TPSocket
Definition:
TPSocket.h:33
bsize
Int_t bsize[]
Definition:
SparseFit4.cxx:31
TPSocket::SendRaw
Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt)
Send a raw buffer of specified length.
Definition:
TPSocket.cxx:554