GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4Socket.h
Go to the documentation of this file.
1 // $Id: TGo4Socket.h 884 2012-11-10 16:47:22Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum f�r Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef TGO4SOCKET_H
15 #define TGO4SOCKET_H
16 
17 #include "Rtypes.h"
18 
19 class TObject;
20 class TSocket;
21 class TServerSocket;
22 
23 class TGo4Socket {
24  public:
25  TGo4Socket(Bool_t IsClient);
26  virtual ~TGo4Socket();
27 
28  virtual Int_t Open(const char* host, Int_t port, Bool_t keepservsock=kFALSE);
29  virtual Int_t Close(Option_t *opt="");
30 
31  virtual Int_t Send(TObject *obj);
32  virtual Int_t Send(const char* name);
33  virtual TObject* Recv(const char* name=0);
34  virtual char* RecvRaw(const char* name=0);
35 
36  Bool_t IsOpen() const { return fbOpen; }
37 
38  Bool_t IsClientMode() const { return fbClientMode; }
39 
40  Int_t GetPort() const { return fiPort; }
41 
47  Int_t SendBuffer(TBuffer* buf);
48 
53  Int_t ReceiveBuffer();
54 
58  const TBuffer * GetBuffer() const { return fxBuffer; }
59 
61  static const Int_t fguOPENWAIT;
62 
64  static const Int_t fgiOPENCYCLES;
65 
67  static const Int_t fgiBUFLENGTH;
68 
70  static const Int_t fgiBUFINITSIZE;
71 
73  static const Int_t fgiBUFEXTRASPACE;
74 
76  static const char* fgcGOON;
77 
79  static const Int_t fgiISOWNER;
80 
81  protected:
82  TGo4Socket(); // not implemented, only for compiler to avoid calling of default
83 
85  void ReallocBuffer(TBuffer* buffer, Int_t oldsize, Int_t newsize);
86 
87  private:
88 
90  Bool_t fbClientMode;
91 
93  Bool_t fbOpen;
94 
96  TSocket * fxSocket;
97 
99  TServerSocket * fxServerSocket;
100 
102  Int_t fiPort;
103 
105 
108  TBuffer * fxBuffer;
109 };
110 
111 #endif
virtual Int_t Close(Option_t *opt="")
Definition: TGo4Socket.cxx:226
TBuffer * fxBuffer
Definition: TGo4Socket.h:108
static const Int_t fgiISOWNER
Definition: TGo4Socket.h:79
const TBuffer * GetBuffer() const
Definition: TGo4Socket.h:58
virtual Int_t Send(TObject *obj)
Definition: TGo4Socket.cxx:352
virtual TObject * Recv(const char *name=0)
Definition: TGo4Socket.cxx:452
Int_t SendBuffer(TBuffer *buf)
Definition: TGo4Socket.cxx:236
static const Int_t fgiOPENCYCLES
Definition: TGo4Socket.h:64
static const Int_t fguOPENWAIT
Definition: TGo4Socket.h:61
TServerSocket * fxServerSocket
Definition: TGo4Socket.h:99
virtual Int_t Open(const char *host, Int_t port, Bool_t keepservsock=kFALSE)
Definition: TGo4Socket.cxx:106
static const Int_t fgiBUFLENGTH
Definition: TGo4Socket.h:67
TSocket * fxSocket
Definition: TGo4Socket.h:96
static const char * fgcGOON
Definition: TGo4Socket.h:76
Bool_t fbClientMode
Definition: TGo4Socket.h:90
Int_t ReceiveBuffer()
Definition: TGo4Socket.cxx:289
virtual ~TGo4Socket()
Definition: TGo4Socket.cxx:78
static const Int_t fgiBUFINITSIZE
Definition: TGo4Socket.h:70
void ReallocBuffer(TBuffer *buffer, Int_t oldsize, Int_t newsize)
Definition: TGo4Socket.cxx:494
Int_t fiPort
Definition: TGo4Socket.h:102
Bool_t fbOpen
Definition: TGo4Socket.h:93
Bool_t IsClientMode() const
Definition: TGo4Socket.h:38
Int_t GetPort() const
Definition: TGo4Socket.h:40
Bool_t IsOpen() const
Definition: TGo4Socket.h:36
virtual char * RecvRaw(const char *name=0)
Definition: TGo4Socket.cxx:421
static const Int_t fgiBUFEXTRASPACE
Definition: TGo4Socket.h:73
char * fxLocalBuffer
Definition: TGo4Socket.h:104