Belle II Software
release-06-02-00
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
z
Typedefs
a
b
c
d
e
i
k
l
m
n
p
r
s
t
u
v
w
Enumerations
Enumerator
c
d
f
p
t
u
v
w
Classes
Class List
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
q
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
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Functions
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
sm_server.cc
1
/**************************************************************************
2
* basf2 (Belle II Analysis Software Framework) *
3
* Author: The Belle II Collaboration *
4
* *
5
* See git log for contributors and copyright holders. *
6
* This file is licensed under LGPL-3.0, see LICENSE.md. *
7
**************************************************************************/
8
9
#include <daq/dataflow/SocketLib.h>
10
#include <daq/dataflow/SocketManager.h>
11
12
#include <cstdio>
13
#include <cstdlib>
14
#include <unistd.h>
15
16
using namespace
std;
17
using namespace
Belle2
;
18
19
int
main
(
int
argc,
char
** argv)
20
{
21
// Open socket to accept connection
22
SocketRecv
recsock((
unsigned
short
)(atoi(argv[1])));
23
24
// Register it in SocketManager
25
SocketManager
sockman(recsock.sock());
26
27
// Loop forever
28
int
count = 0;
29
for
(;;) {
30
// Check I/O request
31
int
is = sockman.examine();
32
if
(is == 0) {
33
printf(
"New connection made\n"
);
34
}
else
if
(is == 1) {
35
int
datbuf;
36
vector<int>& socklist = sockman.connected_socket_list();
37
printf(
"no. of connected sockets = %d\n"
, socklist.size());
38
for
(vector<int>::iterator it = socklist.begin(); it != socklist.end(); ++it) {
39
int
fd = *it;
40
int
is = read(fd, &datbuf, 4);
41
printf(
"Data read from sock %d (%d), ret = %d\n"
, fd, count++, is);
42
}
43
}
44
}
45
}
Belle2::SocketManager
Definition:
SocketManager.h:20
Belle2::SocketRecv
Definition:
SocketLib.h:48
Belle2
Abstract base class for different kinds of events.
Definition:
MillepedeAlgorithm.h:17
main
int main(int argc, char **argv)
Run all tests.
Definition:
test_main.cc:75
daq
dataflow
tools
sm_server.cc
Generated on Thu Dec 28 2023 02:21:29 for Belle II Software by
1.9.1