ROOT logo

From $ROOTSYS/tutorials/net/authserv.C

//--------------------------------------------------
#include "TPServerSocket.h"

//
// This macro should be run together with authclient.C to test
// authentication between two remote ROOT sessions. 
// Run first the authserv.C within a ROOT session on the server
// machine, eg. "srv.machi.ne":
//
//          root[] .x authserv.C(3000)
//
// authserv accepts as argument the port wher it starts listening
// (default 3000).
// You can then run authclient.c in a ROOT session on the client
// machine:
//          root[] .x authclient.C("srv.machi.ne:3000")
//
// and you should get prompted for the credentials, if the case.
// To start a parallel socket of size, for example, 5, enter the
// size as second argument, ie
//
//          root[] .x authclient.C("srv.machi.ne:3000",5)
//

int authserv(int po = 3000)
{

   UChar_t oauth = kSrvAuth;

   TServerSocket *ss = 0;
   TSocket *s = 0;

   cout << "authserv: starting a (parallel) server socket on port "
        << po << " with authentication" << endl;
 
   ss = new TPServerSocket(po);

   // Get the connection
   s = ss->Accept(oauth);

   // Print out;
   if (s) 
      if (s->IsAuthenticated()) 
         cout << "authserv: srv auth socket: OK" << endl;
      else
         cout << "authserv: srv auth socket: failed" << endl;

   // Cleanup
   if (s) delete s;
   if (ss) delete ss;
}
//--------------------------------------------------

 authserv.C:1
 authserv.C:2
 authserv.C:3
 authserv.C:4
 authserv.C:5
 authserv.C:6
 authserv.C:7
 authserv.C:8
 authserv.C:9
 authserv.C:10
 authserv.C:11
 authserv.C:12
 authserv.C:13
 authserv.C:14
 authserv.C:15
 authserv.C:16
 authserv.C:17
 authserv.C:18
 authserv.C:19
 authserv.C:20
 authserv.C:21
 authserv.C:22
 authserv.C:23
 authserv.C:24
 authserv.C:25
 authserv.C:26
 authserv.C:27
 authserv.C:28
 authserv.C:29
 authserv.C:30
 authserv.C:31
 authserv.C:32
 authserv.C:33
 authserv.C:34
 authserv.C:35
 authserv.C:36
 authserv.C:37
 authserv.C:38
 authserv.C:39
 authserv.C:40
 authserv.C:41
 authserv.C:42
 authserv.C:43
 authserv.C:44
 authserv.C:45
 authserv.C:46
 authserv.C:47
 authserv.C:48
 authserv.C:49
 authserv.C:50
 authserv.C:51
 authserv.C:52
 authserv.C:53
 authserv.C:54