Belle II Software
release-05-02-19
TCPSocket.h
1
#ifndef _B2ARICH_TCPSocket_hh_
2
#define _B2ARICH_TCPSocket_hh_
3
4
#include <string>
5
6
#include "daq/slc/system/FileDescriptor.h"
7
8
namespace
Belle2
{
14
class
TCPSocket
:
public
FileDescriptor
{
15
16
friend
class
TCPServerSocket
;
17
18
public
:
19
TCPSocket
() : m_ip(
""
), m_port(0) {}
20
TCPSocket
(
const
std::string& ip,
unsigned
short
port)
21
: m_ip(ip), m_port(port) {}
22
virtual
~
TCPSocket
() {}
23
24
private
:
25
TCPSocket
(
int
fd) :
FileDescriptor
(fd), m_ip(
""
), m_port(0) {}
26
27
public
:
28
void
setIP(
const
std::string& ip) { m_ip = ip; }
29
void
setPort(
unsigned
short
port) { m_port = port; }
30
const
std::string& getIP()
const
{
return
m_ip; }
31
unsigned
short
getPort()
const
{
return
m_port; }
32
int
connect();
33
int
connect(
const
std::string& ip,
unsigned
short
port);
34
void
setBufferSize(
int
size);
35
void
print();
36
const
std::string getLocalIP();
37
int
getLocalAddress();
38
int
getLocalPort();
39
unsigned
int
getAddress();
40
41
public
:
42
virtual
size_t
write(
const
void
* v,
size_t
count);
43
virtual
size_t
read(
void
* v,
size_t
count);
44
size_t
read_once(
void
* v,
size_t
count);
45
46
private
:
47
std::string m_ip;
48
unsigned
short
m_port;
49
50
};
51
53
}
54
55
#endif
56
Belle2
Abstract base class for different kinds of events.
Definition:
MillepedeAlgorithm.h:19
Belle2::TCPServerSocket
Definition:
TCPServerSocket.h:13
Belle2::TCPSocket
Definition:
TCPSocket.h:14
Belle2::FileDescriptor
Definition:
FileDescriptor.h:10
daq
slc
system
include
TCPSocket.h
Generated on Tue Jan 4 2022 02:54:37 for Belle II Software by
1.8.17