#ifndef ROOT_TPSocket
#define ROOT_TPSocket
#ifndef ROOT_TSocket
#include "TSocket.h"
#endif
class TMonitor;
class TPSocket : public TSocket {
friend class TPServerSocket;
private:
TSocket **fSockets;
TMonitor *fWriteMonitor;
TMonitor *fReadMonitor;
Int_t fSize;
Int_t *fWriteBytesLeft;
Int_t *fReadBytesLeft;
char **fWritePtr;
char **fReadPtr;
TPSocket(TSocket *pSockets[], Int_t size);
TPSocket(const TPSocket &);
void operator=(const TPSocket &);
void Init(Int_t tcpwindowsize, TSocket *sock = 0);
Option_t *GetOption() const { return TObject::GetOption(); }
public:
TPSocket(TInetAddress address, const char *service, Int_t size,
Int_t tcpwindowsize = -1);
TPSocket(TInetAddress address, Int_t port, Int_t size,
Int_t tcpwindowsize = -1);
TPSocket(const char *host, const char *service, Int_t size,
Int_t tcpwindowsize = -1);
TPSocket(const char *host, Int_t port, Int_t size, Int_t tcpwindowsize = -1);
TPSocket(const char *host, Int_t port, Int_t size, TSocket *sock);
virtual ~TPSocket();
void Close(Option_t *opt="");
Int_t GetDescriptor() const;
TInetAddress GetLocalInetAddress();
Int_t Send(const TMessage &mess);
Int_t Send(Int_t kind) { return TSocket::Send(kind); }
Int_t Send(Int_t status, Int_t kind) { return TSocket::Send(status, kind); }
Int_t Send(const char *mess, Int_t kind = kMESS_STRING) { return TSocket::Send(mess, kind); }
Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt);
Int_t Recv(TMessage *&mess);
Int_t Recv(Int_t &status, Int_t &kind) { return TSocket::Recv(status, kind); }
Int_t Recv(char *mess, Int_t max) { return TSocket::Recv(mess, max); }
Int_t Recv(char *mess, Int_t max, Int_t &kind) { return TSocket::Recv(mess, max, kind); }
Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt);
Bool_t IsValid() const { return fSockets ? kTRUE : kFALSE; }
Int_t GetErrorCode() const;
Int_t SetOption(ESockOptions opt, Int_t val);
Int_t GetOption(ESockOptions opt, Int_t &val);
Int_t GetSize() const { return fSize; }
ClassDef(TPSocket,0)
};
#endif