Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TServerSocket.h
Go to the documentation of this file.
1// @(#)root/net:$Id$
2// Author: Fons Rademakers 18/12/96
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TServerSocket
13#define ROOT_TServerSocket
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TServerSocket //
19// //
20// This class implements server sockets. A server socket waits for //
21// requests to come in over the network. It performs some operation //
22// based on that request and then possibly returns a full duplex socket //
23// to the requester. The actual work is done via the TSystem class //
24// (either TUnixSystem or TWinNTSystem). //
25// //
26//////////////////////////////////////////////////////////////////////////
27
28#include "TSocket.h"
29#include <string>
30
31class TSeqCollection;
32
33class TServerSocket : public TSocket {
34
35private:
36 TServerSocket() = default;
38 void operator=(const TServerSocket &);
39
40public:
41 enum { kDefaultBacklog = 10 };
42
43 TServerSocket(Int_t port, Bool_t reuse = kFALSE, Int_t backlog = kDefaultBacklog, Int_t tcpwindowsize = -1,
45 TServerSocket(const char *service, Bool_t reuse = kFALSE,
46 Int_t backlog = kDefaultBacklog, Int_t tcpwindowsize = -1);
47 virtual ~TServerSocket();
48
49 virtual TSocket *Accept(UChar_t opt = 0);
51 Int_t GetLocalPort() override;
52
53 Int_t Send(const TMessage &) override
54 { MayNotUse("Send(const TMessage &)"); return 0; }
55 Int_t Send(Int_t) override
56 { MayNotUse("Send(Int_t)"); return 0; }
57 Int_t Send(Int_t, Int_t) override
58 { MayNotUse("Send(Int_t, Int_t)"); return 0; }
59 Int_t Send(const char *, Int_t = kMESS_STRING) override
60 { MayNotUse("Send(const char *, Int_t)"); return 0; }
62 { MayNotUse("SendObject(const TObject *, Int_t)"); return 0; }
63 Int_t SendRaw(const void *, Int_t, ESendRecvOptions = kDefault) override
64 { MayNotUse("SendRaw(const void *, Int_t, ESendRecvOptions)"); return 0; }
65 Int_t Recv(TMessage *&) override
66 { MayNotUse("Recv(TMessage *&)"); return 0; }
67 Int_t Recv(Int_t &, Int_t &) override
68 { MayNotUse("Recv(Int_t &, Int_t &)"); return 0; }
69 Int_t Recv(char *, Int_t) override
70 { MayNotUse("Recv(char *, Int_t)"); return 0; }
71 Int_t Recv(char *, Int_t, Int_t &) override
72 { MayNotUse("Recv(char *, Int_t, Int_t &)"); return 0; }
74 { MayNotUse("RecvRaw(void *, Int_t, ESendRecvOptions)"); return 0; }
75
76 ClassDefOverride(TServerSocket, 0); //This class implements server sockets
77};
78
79#endif
@ kMESS_STRING
@ kMESS_OBJECT
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
Definition RtypesCore.h:52
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
ESendRecvOptions
Definition TSystem.h:242
@ kDefault
Definition TSystem.h:243
ESocketBindOption
Options for binging the sockets created.
Definition TSystem.h:46
@ kInaddrAny
Any address for socket binding.
Definition TSystem.h:47
This class represents an Internet Protocol (IP) address.
void MayNotUse(const char *method) const
Use this method to signal that a method (defined in a base class) may not be called in a derived clas...
Definition TObject.cxx:1160
TObject()
TObject constructor.
Definition TObject.h:259
Sequenceable collection abstract base class.
Int_t Recv(char *, Int_t) override
Receive a character string message of maximum max length.
Int_t Recv(Int_t &, Int_t &) override
Receives a status and a message type.
TServerSocket(const TServerSocket &)
Int_t Send(Int_t) override
Send a single message opcode.
Int_t Send(Int_t, Int_t) override
Send a status and a single message opcode.
Int_t Recv(char *, Int_t, Int_t &) override
Receive a character string message of maximum max length.
void operator=(const TServerSocket &)
Int_t Send(const char *, Int_t=kMESS_STRING) override
Send a character string buffer.
Int_t RecvRaw(void *, Int_t, ESendRecvOptions=kDefault) override
Receive a raw buffer of specified length bytes.
Int_t GetLocalPort() override
Get port # to which server socket is bound. In case of error returns -1.
virtual ~TServerSocket()
Destructor: close connection.
Int_t Recv(TMessage *&) override
Receive a TMessage object.
TServerSocket()=default
Int_t SendRaw(const void *, Int_t, ESendRecvOptions=kDefault) override
Send a raw buffer of specified length.
Int_t SendObject(const TObject *, Int_t=kMESS_OBJECT) override
Send an object.
virtual TSocket * Accept(UChar_t opt=0)
Accept a connection on a server socket.
TInetAddress GetLocalInetAddress() override
Return internet address of host to which the server socket is bound, i.e.
Int_t Send(const TMessage &) override
Send a TMessage object.
This class implements client sockets.
Definition TSocket.h:39
TSocket()
Definition TSocket.h:85