Loading [MathJax]/jax/output/HTML-CSS/config.js
ROOT
6.14/05
Reference Guide
ROOT Home
Main Page
Tutorials
Functional Parts
+
Namespaces
Namespace List
+
Namespace Members
+
All
<
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
<
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
u
w
x
+
Enumerations
a
e
f
g
m
p
t
v
w
y
+
Enumerator
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
w
+
All Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
+
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
w
y
+
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Properties
f
+
Related Functions
:
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Files
File List
+
File Members
+
All
1
2
3
4
5
6
7
8
9
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
+
Enumerations
c
e
f
i
l
m
p
r
u
x
+
Enumerator
a
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
u
v
w
+
Macros
1
2
3
4
5
6
7
8
9
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Release Notes
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
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
TPSocket::SendRaw
Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt)
Send a raw buffer of specified length.
Definition:
TPSocket.cxx:554