00001 //------------------------------------------------------------- 00002 // Go4 Release Package v3.04-01 (build 30401) 00003 // 28-November-2008 00004 //--------------------------------------------------------------- 00005 // The GSI Online Offline Object Oriented (Go4) Project 00006 // Experiment Data Processing at EE department, GSI 00007 //--------------------------------------------------------------- 00008 // 00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI 00010 // Planckstr. 1, 64291 Darmstadt, Germany 00011 //Contact: http://go4.gsi.de 00012 //---------------------------------------------------------------- 00013 //This software can be used under the license agreements as stated 00014 //in Go4License.txt file which is part of the distribution. 00015 //---------------------------------------------------------------- 00016 #ifndef TGO4SOCKET_H 00017 #define TGO4SOCKET_H 00018 00019 #include "Rtypes.h" 00020 00021 class TObject; 00022 class TSocket; 00023 class TServerSocket; 00024 class TGo4SocketSignalHandler; 00025 00026 class TGo4Socket { 00027 public: 00028 TGo4Socket(Bool_t IsClient); 00029 virtual ~TGo4Socket(); 00030 00031 virtual Int_t Open(const char* host, Int_t port, Bool_t keepservsock=kFALSE); 00032 virtual Int_t Close(Option_t *opt=""); 00033 00034 virtual Int_t Send(TObject *obj); 00035 virtual Int_t Send(const char* name); 00036 virtual TObject* Recv(const char* name=0); 00037 virtual Text_t* RecvRaw(const char* name=0); 00038 00039 Bool_t IsOpen() const { return fbOpen; } 00040 00041 Bool_t IsClientMode() const { return fbClientMode; } 00042 00043 Int_t GetPort() const { return fiPort; } 00044 00050 Int_t SendBuffer(TBuffer* buf); 00051 00056 Int_t ReceiveBuffer(); 00057 00061 const TBuffer * GetBuffer() const { return fxBuffer; } 00062 00064 static const Int_t fguOPENWAIT; 00065 00067 static const Int_t fgiOPENCYCLES; 00068 00070 static const Int_t fgiBUFLENGTH; 00071 00073 static const Int_t fgiBUFINITSIZE; 00074 00076 static const Int_t fgiBUFEXTRASPACE; 00077 00079 static const char* fgcGOON; 00080 00082 static const Int_t fgiISOWNER; 00083 00084 protected: 00085 TGo4Socket(); // not implemented, only for compiler to avoid calling of default 00086 00088 void ReallocBuffer(TBuffer* buffer, Int_t oldsize, Int_t newsize); 00089 00090 private: 00091 00093 Bool_t fbClientMode; 00094 00096 Bool_t fbOpen; 00097 00100 TGo4SocketSignalHandler * fxSignalHandler; 00101 00103 TSocket * fxSocket; 00104 00106 TServerSocket * fxServerSocket; 00107 00109 Int_t fiPort; 00110 00111 Text_t* fxLocalBuffer; 00112 00115 TBuffer * fxBuffer; 00116 }; 00117 00118 #endif 00119 00120 //----------------------------END OF GO4 SOURCE FILE ---------------------