Belle II Software development
RSocketLib.h
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#ifndef RSOCKETLIB_H
9#define RSOCKETLIB_H
10
11#include <netinet/in.h>
12
13#define D2_SOCKBUF_SIZE 8000000
14
15#include "daq/dataflow/SocketLib.h"
16
17typedef unsigned short u_short;
18
19namespace Belle2 {
25 class RSocketSend : public SocketIO {
26 public:
27 RSocketSend(u_short port);
29
30 int examine();
31 int accept();
32 int close();
33
34 int sock() const;
35 int sender() const;
36 void sock(int sockid);
37 int port() const;
38
39 int get(char* data, int len);
40 int read(char* data, int len);
41 int put(char* data, int len);
42 int put_wordbuf(int* data, int len);
43 int write(char* data, int len);
44
45 int err() const;
46 void interrupt();
47
48 private:
49 SocketIO m_io;
50 int m_sock;
51 int m_port;
52 int m_sender;
53 int m_errno;
54
55 };
56
57 class RSocketRecv : public SocketIO {
58 public:
59 RSocketRecv(const char* node, u_short prt);
61
62 int reconnect(int ntry);
63
64 int put(char* data, int len);
65 int write(char* data, int len);
66 int get(char* data, int len);
67 int get_wordbuf(int* data, int len);
68 int read(char* data, int len);
69
70 char* node(void);
71 int port(void);
72 int sock(void);
73 void sock(int sockid);
74
75 int err(void);
76
77 private:
78 SocketIO m_io;
79 struct hostent* m_hp;
80 struct sockaddr_in m_sa;
81 int m_sock;
82 int m_port;
83 char m_node[128];
84 int m_errno;
85
86 };
87
89}
90#endif
91
92
93
94
95
96
Abstract base class for different kinds of events.