GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4Socket.h
Go to the documentation of this file.
1 // $Id: TGo4Socket.h 2627 2019-10-01 08:02:45Z 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 fuer 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 
78  protected:
79  TGo4Socket(); // not implemented, only for compiler to avoid calling of default
80 
82  void ReallocBuffer(TBuffer* buffer, Int_t oldsize, Int_t newsize);
83 
84  private:
85 
87  Bool_t fbClientMode;
88 
90  Bool_t fbOpen;
91 
93  TSocket * fxSocket;
94 
96  TServerSocket * fxServerSocket;
97 
99  Int_t fiPort;
100 
102 
105  TBuffer * fxBuffer;
106 };
107 
108 #endif
virtual Int_t Close(Option_t *opt="")
Definition: TGo4Socket.cxx:212
TBuffer * fxBuffer
Definition: TGo4Socket.h:105
const TBuffer * GetBuffer() const
Definition: TGo4Socket.h:58
virtual Int_t Send(TObject *obj)
Definition: TGo4Socket.cxx:338
virtual TObject * Recv(const char *name=0)
Definition: TGo4Socket.cxx:438
Int_t SendBuffer(TBuffer *buf)
Definition: TGo4Socket.cxx:222
static const Int_t fgiOPENCYCLES
Definition: TGo4Socket.h:64
static const Int_t fguOPENWAIT
Definition: TGo4Socket.h:61
TServerSocket * fxServerSocket
Definition: TGo4Socket.h:96
virtual Int_t Open(const char *host, Int_t port, Bool_t keepservsock=kFALSE)
Definition: TGo4Socket.cxx:92
static const Int_t fgiBUFLENGTH
Definition: TGo4Socket.h:67
TSocket * fxSocket
Definition: TGo4Socket.h:93
static const char * fgcGOON
Definition: TGo4Socket.h:76
Bool_t fbClientMode
Definition: TGo4Socket.h:87
Int_t ReceiveBuffer()
Definition: TGo4Socket.cxx:275
virtual ~TGo4Socket()
Definition: TGo4Socket.cxx:64
static const Int_t fgiBUFINITSIZE
Definition: TGo4Socket.h:70
void ReallocBuffer(TBuffer *buffer, Int_t oldsize, Int_t newsize)
Definition: TGo4Socket.cxx:480
Int_t fiPort
Definition: TGo4Socket.h:99
Bool_t fbOpen
Definition: TGo4Socket.h:90
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:407
static const Int_t fgiBUFEXTRASPACE
Definition: TGo4Socket.h:73
char * fxLocalBuffer
Definition: TGo4Socket.h:101