00001 //-------------------------------------------------- 00002 #include "TPServerSocket.h" 00003 00004 // 00005 // This macro should be run together with authclient.C to test 00006 // authentication between two remote ROOT sessions. 00007 // Run first the authserv.C within a ROOT session on the server 00008 // machine, eg. "srv.machi.ne": 00009 // 00010 // root[] .x authserv.C(3000) 00011 // 00012 // authserv accepts as argument the port wher it starts listening 00013 // (default 3000). 00014 // You can then run authclient.c in a ROOT session on the client 00015 // machine: 00016 // root[] .x authclient.C("srv.machi.ne:3000") 00017 // 00018 // and you should get prompted for the credentials, if the case. 00019 // To start a parallel socket of size, for example, 5, enter the 00020 // size as second argument, ie 00021 // 00022 // root[] .x authclient.C("srv.machi.ne:3000",5) 00023 // 00024 00025 int authserv(int po = 3000) 00026 { 00027 00028 UChar_t oauth = kSrvAuth; 00029 00030 TServerSocket *ss = 0; 00031 TSocket *s = 0; 00032 00033 cout << "authserv: starting a (parallel) server socket on port " 00034 << po << " with authentication" << endl; 00035 00036 ss = new TPServerSocket(po); 00037 00038 // Get the connection 00039 s = ss->Accept(oauth); 00040 00041 // Print out; 00042 if (s) 00043 if (s->IsAuthenticated()) 00044 cout << "authserv: srv auth socket: OK" << endl; 00045 else 00046 cout << "authserv: srv auth socket: failed" << endl; 00047 00048 // Cleanup 00049 if (s) delete s; 00050 if (ss) delete ss; 00051 } 00052 //-------------------------------------------------- 00053