CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/IORawData/DTCommissioning/src/DTSpyHelper.h

Go to the documentation of this file.
00001 #ifndef DaqSource_DTSpyHelper_h
00002 #define DaqSource_DTSpyHelper_h
00003 
00004 
00005 #include <sys/types.h>
00006 #include <sys/socket.h>
00007 #include <netinet/tcp.h>
00008 #include <netinet/in.h>
00009 #include <stdio.h>
00010 #include <netdb.h>
00011 
00012 class DTtcpExcp
00013 {
00014      int errornumber;
00015   public:
00016    DTtcpExcp(int err):errornumber(err){};
00017 };
00018 
00019 class DTCtcp
00020 {
00021   protected:
00022 
00023     int port;
00024     int sock;
00025 
00026     int connected;
00027     struct sockaddr_in clientAddr;
00028     struct sockaddr_in myaddr;
00029 
00030 
00031   public:
00032 
00033     DTCtcp();
00034     DTCtcp(int port);
00035     DTCtcp(int sock,int opt);
00036     DTCtcp(DTCtcp *);
00037     ~DTCtcp();
00038 
00039     DTCtcp * Accept();
00040     void Connect(const char *hostaddr,int port);
00041     void Connect(unsigned long hostaddr,int port);
00042     int Disconnect();
00043    
00044     short Id();
00045     unsigned long addr();
00046     int Send(char * buffer,int size); 
00047     int Receive(char *buffer,int size);
00048     int WaitData(int timeout);
00049 
00050 };
00051 
00052 #endif