CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DTSpyHelper.h
Go to the documentation of this file.
1 #ifndef DaqSource_DTSpyHelper_h
2 #define DaqSource_DTSpyHelper_h
3 
4 #include <sys/types.h>
5 #include <sys/socket.h>
6 #include <netinet/tcp.h>
7 #include <netinet/in.h>
8 #include <cstdio>
9 #include <netdb.h>
10 
11 class DTtcpExcp {
13 
14 public:
15  DTtcpExcp(int err) : errornumber(err){};
16 };
17 
18 class DTCtcp {
19 protected:
20  int port;
21  int sock;
22 
23  int connected;
24  struct sockaddr_in clientAddr;
25  struct sockaddr_in myaddr;
26 
27 public:
28  DTCtcp();
29  DTCtcp(int port);
30  DTCtcp(int sock, int opt);
31  DTCtcp(DTCtcp *);
32  ~DTCtcp();
33 
34  DTCtcp *Accept();
35  void Connect(const char *hostaddr, int port);
36  void Connect(unsigned long hostaddr, int port);
37  int Disconnect();
38 
39  short Id();
40  unsigned long addr();
41  int Send(char *buffer, int size);
42  int Receive(char *buffer, int size);
43 };
44 
45 #endif
int Receive(char *buffer, int size)
Definition: DTSpyHelper.cc:145
int Send(char *buffer, int size)
Definition: DTSpyHelper.cc:165
int Disconnect()
Definition: DTSpyHelper.cc:95
int errornumber
Definition: DTSpyHelper.h:12
struct sockaddr_in myaddr
Definition: DTSpyHelper.h:25
short Id()
Definition: DTSpyHelper.cc:83
void Connect(const char *hostaddr, int port)
Definition: DTSpyHelper.cc:133
int sock
Definition: DTSpyHelper.h:21
int connected
Definition: DTSpyHelper.h:23
int port
Definition: DTSpyHelper.h:20
DTtcpExcp(int err)
Definition: DTSpyHelper.h:15
DTCtcp * Accept()
Definition: DTSpyHelper.cc:100
unsigned long addr()
Definition: DTSpyHelper.cc:89
struct sockaddr_in clientAddr
Definition: DTSpyHelper.h:24
tuple size
Write out results.