File indexing completed on 2024-09-07 04:36:41
0001 #ifndef DaqSource_DTSpyHelper_h
0002 #define DaqSource_DTSpyHelper_h
0003
0004 #include <sys/types.h>
0005 #include <sys/socket.h>
0006 #include <netinet/tcp.h>
0007 #include <netinet/in.h>
0008 #include <cstdio>
0009 #include <netdb.h>
0010
0011 class DTtcpExcp {
0012 int errornumber;
0013
0014 public:
0015 DTtcpExcp(int err) : errornumber(err) {}
0016 };
0017
0018 class DTCtcp {
0019 protected:
0020 int port;
0021 int sock;
0022
0023 int connected;
0024 struct sockaddr_in clientAddr;
0025 struct sockaddr_in myaddr;
0026
0027 public:
0028 DTCtcp();
0029 DTCtcp(int port);
0030 DTCtcp(int sock, int opt);
0031 DTCtcp(DTCtcp *);
0032 ~DTCtcp();
0033
0034 DTCtcp *Accept();
0035 void Connect(const char *hostaddr, int port);
0036 void Connect(unsigned long hostaddr, int port);
0037 int Disconnect();
0038
0039 short Id();
0040 unsigned long addr();
0041 int Send(char *buffer, int size);
0042 int Receive(char *buffer, int size);
0043 };
0044
0045 #endif