00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TPSocket
00013 #define ROOT_TPSocket
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ROOT_TSocket
00029 #include "TSocket.h"
00030 #endif
00031
00032 class TMonitor;
00033
00034
00035 class TPSocket : public TSocket {
00036
00037 friend class TPServerSocket;
00038
00039 private:
00040 TSocket **fSockets;
00041 TMonitor *fWriteMonitor;
00042 TMonitor *fReadMonitor;
00043 Int_t fSize;
00044 Int_t *fWriteBytesLeft;
00045 Int_t *fReadBytesLeft;
00046 char **fWritePtr;
00047 char **fReadPtr;
00048
00049 TPSocket(TSocket *pSockets[], Int_t size);
00050 TPSocket(const TPSocket &);
00051 void operator=(const TPSocket &);
00052 void Init(Int_t tcpwindowsize, TSocket *sock = 0);
00053 Option_t *GetOption() const { return TObject::GetOption(); }
00054
00055 public:
00056 TPSocket(TInetAddress address, const char *service, Int_t size,
00057 Int_t tcpwindowsize = -1);
00058 TPSocket(TInetAddress address, Int_t port, Int_t size,
00059 Int_t tcpwindowsize = -1);
00060 TPSocket(const char *host, const char *service, Int_t size,
00061 Int_t tcpwindowsize = -1);
00062 TPSocket(const char *host, Int_t port, Int_t size, Int_t tcpwindowsize = -1);
00063 TPSocket(const char *host, Int_t port, Int_t size, TSocket *sock);
00064 virtual ~TPSocket();
00065
00066 void Close(Option_t *opt="");
00067 Int_t GetDescriptor() const;
00068 TInetAddress GetLocalInetAddress();
00069
00070 Int_t Send(const TMessage &mess);
00071 Int_t Send(Int_t kind) { return TSocket::Send(kind); }
00072 Int_t Send(Int_t status, Int_t kind) { return TSocket::Send(status, kind); }
00073 Int_t Send(const char *mess, Int_t kind = kMESS_STRING) { return TSocket::Send(mess, kind); }
00074 Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt);
00075 Int_t Recv(TMessage *&mess);
00076 Int_t Recv(Int_t &status, Int_t &kind) { return TSocket::Recv(status, kind); }
00077 Int_t Recv(char *mess, Int_t max) { return TSocket::Recv(mess, max); }
00078 Int_t Recv(char *mess, Int_t max, Int_t &kind) { return TSocket::Recv(mess, max, kind); }
00079 Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt);
00080
00081 Bool_t IsValid() const { return fSockets ? kTRUE : kFALSE; }
00082 Int_t GetErrorCode() const;
00083 Int_t SetOption(ESockOptions opt, Int_t val);
00084 Int_t GetOption(ESockOptions opt, Int_t &val);
00085 Int_t GetSize() const { return fSize; }
00086
00087 ClassDef(TPSocket,0)
00088 };
00089
00090 #endif