ROOT logo
ROOT » NET » NET » TServerSocket

class TServerSocket: public TSocket


TServerSocket

This class implements server sockets. A server socket waits for
requests to come in over the network. It performs some operation
based on that request and then possibly returns a full duplex socket
to the requester. The actual work is done via the TSystem class
(either TUnixSystem or TWinNTSystem).


Function Members (Methods)

public:
TServerSocket(Int_t port, Bool_t reuse = kFALSE, Int_t backlog = kDefaultBacklog, Int_t tcpwindowsize = -1)
TServerSocket(const char* service, Bool_t reuse = kFALSE, Int_t backlog = kDefaultBacklog, Int_t tcpwindowsize = -1)
virtual~TServerSocket()
voidTObject::AbstractMethod(const char* method) const
virtual TSocket*Accept(UChar_t Opt = 0)
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual voidTSocket::Close(Option_t* opt = "")
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
static TSocket*TSocket::CreateAuthSocket(const char* url, Int_t size = 0, Int_t tcpwindowsize = -1, TSocket* s = 0)
static TSocket*TSocket::CreateAuthSocket(const char* user, const char* host, Int_t port, Int_t size = 0, Int_t tcpwindowsize = -1, TSocket* s = 0)
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
static UChar_tGetAcceptOptions()
UInt_tTSocket::GetBytesRecv() const
UInt_tTSocket::GetBytesSent() const
static Int_tTSocket::GetClientProtocol()
Int_tTSocket::GetCompressionLevel() const
virtual Int_tTSocket::GetDescriptor() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
Int_tTSocket::GetErrorCode() const
virtual const char*TObject::GetIconName() const
TInetAddressTSocket::GetInetAddress() const
TTimeStampTSocket::GetLastUsage()
virtual TInetAddressGetLocalInetAddress()
virtual Int_tGetLocalPort()
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Int_tTSocket::GetOption(ESockOptions opt, Int_t& val)
Int_tTSocket::GetPort() const
Int_tTSocket::GetRemoteProtocol() const
TSecContext*TSocket::GetSecContext() const
const char*TSocket::GetService() const
Int_tTSocket::GetServType() const
static ULong64_tTSocket::GetSocketBytesRecv()
static ULong64_tTSocket::GetSocketBytesSent()
Int_tTSocket::GetTcpWindowSize() const
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
const char*TSocket::GetUrl() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTSocket::IsAuthenticated() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
virtual Bool_tTSocket::IsValid() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
static voidTSocket::NetError(const char* where, Int_t error)
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual Int_tTSocket::Reconnect()
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual Int_tRecv(TMessage*&)
virtual Int_tRecv(Int_t&, Int_t&)
virtual Int_tRecv(char*, Int_t)
virtual Int_tRecv(char*, Int_t, Int_t&)
virtual Int_tRecvRaw(void*, Int_t, ESendRecvOptions = kDefault)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
virtual Int_tTSocket::Select(Int_t interest = kRead, Long_t timeout = -1)
virtual Int_tSend(const TMessage&)
virtual Int_tSend(Int_t)
virtual Int_tSend(Int_t, Int_t)
virtual Int_tSend(const char*, Int_t = kMESS_STRING)
virtual Int_tSendObject(const TObject*, Int_t = kMESS_OBJECT)
virtual Int_tSendRaw(const void*, Int_t, ESendRecvOptions = kDefault)
static voidSetAcceptOptions(UChar_t Opt)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidTSocket::SetCompressionLevel(Int_t level = 1)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual Int_tTSocket::SetOption(ESockOptions opt, Int_t val)
voidTSocket::SetRemoteProtocol(Int_t rproto)
voidTSocket::SetSecContext(TSecContext* ctx)
voidTSocket::SetService(const char* service)
voidTSocket::SetServType(Int_t st)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
voidTSocket::SetUrl(const char* url)
static voidShowAcceptOptions()
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
voidTSocket::Touch()
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
Bool_tTSocket::RecvProcessIDs(TMessage* mess)
Bool_tTSocket::RecvStreamerInfos(TMessage* mess)
voidTSocket::SendProcessIDs(const TMessage& mess)
voidTSocket::SendStreamerInfos(const TMessage& mess)
voidTSocket::SetDescriptor(Int_t desc)

Data Members

public:
enum { kDefaultBacklog
};
enum TSocket::EStatusBits { kIsUnix
};
enum TSocket::EInterest { kRead
kWrite
};
enum TSocket::EServiceType { kSOCKD
kROOTD
kPROOFD
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TInetAddressTSocket::fAddressremote internet address and port #
TBitsTSocket::fBitsInfobits array to mark TStreamerInfo classes already sent
UInt_tTSocket::fBytesRecvtotal bytes received over this socket
UInt_tTSocket::fBytesSenttotal bytes sent using this socket
Int_tTSocket::fCompresscompression level from 0 (not compressed)
TTimeStampTSocket::fLastUsageTime stamp of last usage
TVirtualMutex*TSocket::fLastUsageMtxProtect last usage setting / reading
TInetAddressTSocket::fLocalAddresslocal internet address and port #
TStringTNamed::fNameobject identifier
Int_tTSocket::fRemoteProtocolprotocol of remote daemon
TSecContext*TSocket::fSecContextafter a successful Authenticate call
TSocket::EServiceTypeTSocket::fServTyperemote service type
TStringTSocket::fServicename of service (matches remote port #)
Int_tTSocket::fSocketsocket descriptor
Int_tTSocket::fTcpWindowSizeTCP window size (default 65535);
TStringTNamed::fTitleobject title
TList*TSocket::fUUIDslist of TProcessIDs already sent through the socket
TStringTSocket::fUrlneeds this for special authentication options
static ULong64_tTSocket::fgBytesRecvtotal bytes received by all socket objects
static ULong64_tTSocket::fgBytesSenttotal bytes sent by all socket objects
static Int_tTSocket::fgClientProtocolclient "protocol" version
private:
TSeqCollection*fSecContextsList of TSecContext with cleanup info
static UChar_tfgAcceptOptDefault accept options
static void*fgSrvAuthClupHook
static void*fgSrvAuthHook

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TServerSocket(const char *service, Bool_t reuse, Int_t backlog, Int_t tcpwindowsize)
 Create a server socket object for a named service. Set reuse to true
 to force reuse of the server socket (i.e. do not wait for the time
 out to pass). Using backlog one can set the desirable queue length
 for pending connections.
 Use tcpwindowsize to specify the size of the receive buffer, it has
 to be specified here to make sure the window scale option is set (for
 tcpwindowsize > 65KB and for platforms supporting window scaling).
 Use IsValid() to check the validity of the
 server socket. In case server socket is not valid use GetErrorCode()
 to obtain the specific error value. These values are:
  0 = no error (socket is valid)
 -1 = low level socket() call failed
 -2 = low level bind() call failed
 -3 = low level listen() call failed
 Every valid server socket is added to the TROOT sockets list which
 will make sure that any open sockets are properly closed on
 program termination.
TServerSocket(Int_t port, Bool_t reuse, Int_t backlog, Int_t tcpwindowsize)
 Create a server socket object on a specified port. Set reuse to true
 to force reuse of the server socket (i.e. do not wait for the time
 out to pass). Using backlog one can set the desirable queue length
 for pending connections. If port is 0 a port scan will be done to
 find a free port. This option is mutual exlusive with the reuse option.
 Use tcpwindowsize to specify the size of the receive buffer, it has
 to be specified here to make sure the window scale option is set (for
 tcpwindowsize > 65KB and for platforms supporting window scaling).
 Use IsValid() to check the validity of the
 server socket. In case server socket is not valid use GetErrorCode()
 to obtain the specific error value. These values are:
  0 = no error (socket is valid)
 -1 = low level socket() call failed
 -2 = low level bind() call failed
 -3 = low level listen() call failed
 Every valid server socket is added to the TROOT sockets list which
 will make sure that any open sockets are properly closed on
 program termination.
~TServerSocket()
 Destructor: cleanup authentication stuff (if any) and close
TSocket * Accept(UChar_t Opt = 0)
 Accept a connection on a server socket. Returns a full-duplex
 communication TSocket object. If no pending connections are
 present on the queue and nonblocking mode has not been enabled
 with SetOption(kNoBlock,1) the call blocks until a connection is
 present. The returned socket must be deleted by the user. The socket
 is also added to the TROOT sockets list which will make sure that
 any open sockets are properly closed on program termination.
 In case of error 0 is returned and in case non-blocking I/O is
 enabled and no connections are available -1 is returned.

 Opt can be used to require client authentication; valid options are

    kSrvAuth   =   require client authentication
    kSrvNoAuth =   force no client authentication

 Example: use Opt = kSrvAuth to require client authentication.

 Default options are taken from fgAcceptOpt and are initially
 equivalent to kSrvNoAuth; they can be changed with the static
 method TServerSocket::SetAcceptOptions(Opt).
 The active defaults can be visualized using the static method
 TServerSocket::ShowAcceptOptions().

TInetAddress GetLocalInetAddress()
 Return internet address of host to which the server socket is bound,
 i.e. the local host. In case of error TInetAddress::IsValid() returns
 kFALSE.
Int_t GetLocalPort()
 Get port # to which server socket is bound. In case of error returns -1.
UChar_t GetAcceptOptions()
 Return default options for Accept
void SetAcceptOptions(UChar_t Opt)
 Set default options for Accept according to modifier 'mod'.
 Use:
   kSrvAuth                 require client authentication
   kSrvNoAuth               do not require client authentication
void ShowAcceptOptions()
 Print default options for Accept
Bool_t Authenticate(TSocket* )
 Check authentication request from the client on new
 open connection
TServerSocket()
{ }
TServerSocket(const TServerSocket& )
void operator=(const TServerSocket& )
Int_t Send(const TMessage &)
{ MayNotUse("Send(const TMessage &)"); return 0; }
Int_t Send(Int_t)
{ MayNotUse("Send(Int_t)"); return 0; }
Int_t Send(Int_t, Int_t)
{ MayNotUse("Send(Int_t, Int_t)"); return 0; }
Int_t Send(const char *, Int_t = kMESS_STRING)
{ MayNotUse("Send(const char *, Int_t)"); return 0; }
Int_t SendObject(const TObject* , Int_t = kMESS_OBJECT)
{ MayNotUse("SendObject(const TObject *, Int_t)"); return 0; }
Int_t SendRaw(const void* , Int_t , ESendRecvOptions = kDefault)
{ MayNotUse("SendRaw(const void *, Int_t, ESendRecvOptions)"); return 0; }
Int_t Recv(TMessage*& )
{ MayNotUse("Recv(TMessage *&)"); return 0; }
Int_t Recv(Int_t &, Int_t &)
{ MayNotUse("Recv(Int_t &, Int_t &)"); return 0; }
Int_t Recv(char *, Int_t)
{ MayNotUse("Recv(char *, Int_t)"); return 0; }
Int_t Recv(char* , Int_t , Int_t& )
{ MayNotUse("Recv(char *, Int_t, Int_t &)"); return 0; }
Int_t RecvRaw(void* , Int_t , ESendRecvOptions = kDefault)
{ MayNotUse("RecvRaw(void *, Int_t, ESendRecvOptions)"); return 0; }