File indexing completed on 2025-01-18 10:12:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TPSocket
0013 #define ROOT_TPSocket
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 #include "TSocket.h"
0029
0030 class TMonitor;
0031
0032
0033 class TPSocket : public TSocket {
0034
0035 friend class TPServerSocket;
0036
0037 private:
0038 TSocket **fSockets = nullptr;
0039 TMonitor *fWriteMonitor = nullptr;
0040 TMonitor *fReadMonitor = nullptr;
0041 Int_t fSize;
0042 Int_t *fWriteBytesLeft = nullptr;
0043 Int_t *fReadBytesLeft = nullptr;
0044 char **fWritePtr = nullptr;
0045 char **fReadPtr = nullptr;
0046
0047 TPSocket(TSocket *pSockets[], Int_t size);
0048 TPSocket(const TPSocket &) = delete;
0049 void operator=(const TPSocket &) = delete;
0050 void Init(Int_t tcpwindowsize, TSocket *sock = nullptr);
0051 Option_t *GetOption() const override { return TObject::GetOption(); }
0052
0053 public:
0054 TPSocket(TInetAddress address, const char *service, Int_t size,
0055 Int_t tcpwindowsize = -1);
0056 TPSocket(TInetAddress address, Int_t port, Int_t size,
0057 Int_t tcpwindowsize = -1);
0058 TPSocket(const char *host, const char *service, Int_t size,
0059 Int_t tcpwindowsize = -1);
0060 TPSocket(const char *host, Int_t port, Int_t size, Int_t tcpwindowsize = -1);
0061 TPSocket(const char *host, Int_t port, Int_t size, TSocket *sock);
0062 virtual ~TPSocket();
0063
0064 void Close(Option_t *opt="") override;
0065 Int_t GetDescriptor() const override;
0066 TInetAddress GetLocalInetAddress() override;
0067
0068 Int_t Send(const TMessage &mess) override;
0069 Int_t Send(Int_t kind) override { return TSocket::Send(kind); }
0070 Int_t Send(Int_t status, Int_t kind) override { return TSocket::Send(status, kind); }
0071 Int_t Send(const char *mess, Int_t kind = kMESS_STRING) override { return TSocket::Send(mess, kind); }
0072 Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt = kDefault) override;
0073 Int_t Recv(TMessage *&mess) override;
0074 Int_t Recv(Int_t &status, Int_t &kind) override { return TSocket::Recv(status, kind); }
0075 Int_t Recv(char *mess, Int_t max) override { return TSocket::Recv(mess, max); }
0076 Int_t Recv(char *mess, Int_t max, Int_t &kind) override { return TSocket::Recv(mess, max, kind); }
0077 Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt = kDefault) override;
0078
0079 Bool_t IsValid() const override { return fSockets ? kTRUE : kFALSE; }
0080 Int_t GetErrorCode() const;
0081 Int_t SetOption(ESockOptions opt, Int_t val) override;
0082 Int_t GetOption(ESockOptions opt, Int_t &val) override;
0083 Int_t GetSize() const { return fSize; }
0084
0085 ClassDefOverride(TPSocket,0)
0086 };
0087
0088 #endif