Changeset 8816 for trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.h
- Timestamp:
- 01/16/08 14:34:11 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.h
r4865 r8816 2 2 #define COSY_MTcpIpIO 3 3 4 #ifndef COSY_MThread4 #ifndef MARS_MThread 5 5 #include "MThread.h" 6 #endif7 #ifndef COSY_Log8 #include "log.h"9 6 #endif 10 7 #ifndef MARS_MTime … … 12 9 #endif 13 10 11 14 12 class TString; 15 13 class TSocket; 16 14 class TServerSocket; 17 15 18 class MTcpIpIO : public MThread, public Log 16 // A generalized class for receiving over tcp/ip 17 class MTcpIpI : public MyThreadX 19 18 { 20 19 private: 21 TSocket *fTxSocket; 22 TSocket *fRxSocket; 23 TServerSocket *fServSock; 20 Int_t fPortRx; 24 21 25 MTime fTime; 26 Int_t fSendInterval; // [ms] 22 Int_t Thread(); 27 23 28 v oid Clear();24 virtual void ReadSocket(TSocket &rx) = 0; 29 25 30 26 public: 31 MTcpIpIO(MLog &out=gLog); 27 MTcpIpI(Int_t rx) : MyThreadX(Form("MTcpIpI::%d", rx)), fPortRx(rx) { /*RunThread();*/ } 28 ~MTcpIpI() { CancelThread(); } 29 }; 30 31 32 // A generalized class for sending over tcp/ip 33 class MTcpIpO 34 { 35 private: 36 TSocket *fTxSocket; 37 38 public: 39 MTcpIpO(Int_t tx); 40 ~MTcpIpO(); 41 42 static bool SendFrame(TSocket &tx, const char *msg, int len); 43 static bool SendFrame(const char *addr, int port, const char *msg, int len); 44 45 bool Send(const char *msg, int len); 46 }; 47 48 // This class es espcially meant to receive and send ascii messages 49 class MTcpIpIO : public MTcpIpI, public MTcpIpO 50 { 51 private: 52 void ReadSocket(TSocket &rx); 53 54 public: 55 MTcpIpIO(Int_t tx, Int_t rx); 32 56 ~MTcpIpIO(); 33 57 34 virtual bool Send(const char *msg, bool force);35 58 virtual bool InterpreteStr(TString str); 36 37 void *Thread();38 59 }; 39 60
Note:
See TracChangeset
for help on using the changeset viewer.