ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
authserv.C
Go to the documentation of this file.
1 //--------------------------------------------------
2 #include "TPServerSocket.h"
3 
4 //
5 // This macro should be run together with authclient.C to test
6 // authentication between two remote ROOT sessions.
7 // Run first the authserv.C within a ROOT session on the server
8 // machine, eg. "srv.machi.ne":
9 //
10 // root[] .x authserv.C(3000)
11 //
12 // authserv accepts as argument the port wher it starts listening
13 // (default 3000).
14 // You can then run authclient.c in a ROOT session on the client
15 // machine:
16 // root[] .x authclient.C("srv.machi.ne:3000")
17 //
18 // and you should get prompted for the credentials, if the case.
19 // To start a parallel socket of size, for example, 5, enter the
20 // size as second argument, ie
21 //
22 // root[] .x authclient.C("srv.machi.ne:3000",5)
23 //
24 
25 int authserv(int po = 3000)
26 {
27 
28  UChar_t oauth = kSrvAuth;
29 
30  TServerSocket *ss = 0;
31  TSocket *s = 0;
32 
33  cout << "authserv: starting a (parallel) server socket on port "
34  << po << " with authentication" << endl;
35 
36  ss = new TPServerSocket(po);
37 
38  // Get the connection
39  s = ss->Accept(oauth);
40 
41  // Print out;
42  if (s)
43  if (s->IsAuthenticated())
44  cout << "authserv: srv auth socket: OK" << endl;
45  else
46  cout << "authserv: srv auth socket: failed" << endl;
47 
48  // Cleanup
49  if (s) delete s;
50  if (ss) delete ss;
51 }
52 //--------------------------------------------------
53 
TServerSocket * ss
Definition: hserv2.C:30
virtual Bool_t IsAuthenticated() const
Definition: TSocket.h:161
virtual TSocket * Accept(UChar_t Opt=0)
Accept a connection on a server socket.
const UChar_t kSrvAuth
Definition: TServerSocket.h:41
int authserv(int po=3000)
Definition: authserv.C:25
unsigned char UChar_t
Definition: RtypesCore.h:34