ROOT
master
Reference Guide
Loading...
Searching...
No Matches
authserv.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_net
3
/// This macro should be run together with authclient.C to test
4
/// authentication between two remote ROOT sessions.
5
/// Run first the authserv.C within a ROOT session on the server
6
/// machine, eg. "srv.machi.ne":
7
///
8
/// root[] .x authserv.C(3000)
9
///
10
/// authserv accepts as argument the port where it starts listening
11
/// (default 3000).
12
/// You can then run authclient.c in a ROOT session on the client
13
/// machine:
14
///
15
/// root[] .x authclient.C("srv.machi.ne:3000")
16
///
17
/// and you should get prompted for the credentials, if the case.
18
/// To start a parallel socket of size, for example, 5, enter the
19
/// size as second argument, ie
20
///
21
/// root[] .x authclient.C("srv.machi.ne:3000",5)
22
///
23
///
24
/// \macro_code
25
///
26
/// \author
27
28
#include "
TPServerSocket.h
"
29
30
void
authserv(
int
po = 3000)
31
{
32
33
UChar_t
oauth =
kSrvAuth
;
34
35
TServerSocket
*ss = 0;
36
TSocket
*s = 0;
37
38
cout <<
"authserv: starting a (parallel) server socket on port "
39
<< po <<
" with authentication"
<< endl;
40
41
ss =
new
TPServerSocket
(po);
42
43
// Get the connection
44
s = ss->
Accept
(oauth);
45
46
// Print out;
47
if
(s)
48
if
(s->
IsAuthenticated
())
49
cout <<
"authserv: srv auth socket: OK"
<< endl;
50
else
51
cout <<
"authserv: srv auth socket: failed"
<< endl;
52
53
// Cleanup
54
if
(s)
delete
s;
55
if
(ss)
delete
ss;
56
}
57
UChar_t
unsigned char UChar_t
Definition
RtypesCore.h:38
TPServerSocket.h
kSrvAuth
const UChar_t kSrvAuth
Definition
TServerSocket.h:39
TPServerSocket
Definition
TPServerSocket.h:31
TServerSocket
Definition
TServerSocket.h:42
TServerSocket::Accept
virtual TSocket * Accept(UChar_t Opt=0)
Accept a connection on a server socket.
Definition
TServerSocket.cxx:204
TSocket
Definition
TSocket.h:41
TSocket::IsAuthenticated
virtual Bool_t IsAuthenticated() const
Definition
TSocket.h:131
tutorials
net
authserv.C
ROOT master - Reference Guide Generated on Sat Nov 16 2024 09:39:23 (GVA Time) using Doxygen 1.9.8