[ROOT] Getting crazy about TServerSocket

From: Hermann-Josef Mathes (mathes@ik3.fzk.de)
Date: Thu Nov 29 2001 - 11:11:51 MET


Dear Rooters,

I have a problem with the TServerSocket class which is probably a problem of
the system and not of the TServerSocket. I hope, somebody could give me a
hint where to look at ... ?

This is a part of the code which shows the problem:
   TServerSocket *fServer;

   for(int port = 18888;port<18890;port++) {
     fServer = new TServerSocket(port);
     cout << "port: " << port << " fServer: " << hex << fServer << dec <<
endl;
     cout << "Desc: " << hex << fServer->GetDescriptor() << dec << endl;
     if( fServer->IsValid() ) {
       printf("Socket listening on port %d\n",port);
       break;
     }
    }

   if ( fServer && fServer->IsValid() ) {
   // do something nice ...
   else {
    cerr << "Could not open server socket !" << endl;

    throw 1;
  }

*** The relevant output of the program:
port: 18888 fServer: 0x86dd970
Desc: 86e7280
port: 18889 fServer: 0x86dd970
Desc: 86e7a60
Could not open server socket !
Abort

*** What I found in /proc/<pid> when single stepping through the program:

mathes@iklx12> ls 10216/fd
0  1  2  3  4  5  6  7
mathes@iklx12> ls 10216/fd
0  1  2  3  4  5  6  7  8

Doing netstat -a --ip -n | grep LISTEN shows the two created sockets.
So why does GetDescriptor() return such a large number (still > 0), why is
IsValid() always kFALSE ? I cannot use this socket during the program as the
descriptor is surely larger than FDSET_SIZE.

The System in use is:
SuSE 7.1, kernel 2.4.0-4GB
with gcc 2.95.2 and ROOT 3.00/06

Many thanks
  Hermann-Josef

**************************************************************************
*                                                                        *
*   Dr. Hermann-Josef Mathes                                             *
*   KASCADE & AUGER Collaboration                                        *
*   Forschungszentrum Karlsruhe                Phone: +49 7247 822429    *
*   Institut fuer Kernphysik                   FAX:   +49 7247 824075    *
*   POB 3640                                                             *
*   D-76021 Karlsruhe/Germany                  Mail:  mathes@ik3.fzk.de  *
*                                                     hjmathes@web.de    *
*                                                                        *
*   Feel free to visit my homepage:                                      *
*          http://www-ik3.fzk.de/~mathes/Welcome.html                    *
**************************************************************************



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:10 MET