[ROOT] Bug in TSocketHandler on windows?

From: Anton Fokin (anton.fokin@smartquant.com)
Date: Wed Feb 06 2002 - 10:01:42 MET


Gentlemen,

I am attaching a few lines of code and a makefile (for windows) which
doesn't work on windows but does work on Linux.

Note: I tested this code with the latest root binary on win98 and winNT
and with root 3.01 on Mandrake Linux.

Fons/Valery, could you comment on this please. It is very important for
me to know if this is a bug or feature.

Cheers,
Anton



#include "TROOT.h"
#include "TRint.h"
#include "TSystem.h"
#include "TStyle.h"
#include "TError.h"
#include "TEnv.h"
#include "TSysEvtHandler.h"
#include "TSocket.h"
#include "TServerSocket.h"

class TSocketHandler : public TFileHandler {
private:
   TSocket            *fSocket;      //!socket being handled

public:

            TSocketHandler(TSocket *Socket);

virtual    Bool_t  Notify();

    Bool_t  ReadNotify()  { return Notify(); }
    Bool_t  WriteNotify() { return Notify(); }

   TSocket *GetSocket() const { return fSocket; }
};

TSocketHandler::TSocketHandler(TSocket *Socket) : TFileHandler(Socket->GetDescriptor(), 1)
{
   fSocket      = Socket;

   gSystem->AddFileHandler(this);
}

Bool_t 
TSocketHandler::Notify()
{
  printf("Connection request\n");

  return kTRUE;
}

int main( int argc, char ** argv )
{

  TROOT ROOT("R-Quant", "R-Quant Data Analysis Studio");

  TRint App("R-Quant Data Analysis Studio", &argc, argv, 0, 0, kTRUE);

  TServerSocket  *ServerSocket = new TServerSocket(9999, kTRUE);
  TSocketHandler *Handler      = new TSocketHandler(ServerSocket);

  App.Run(kTRUE);

  return 0;
}


ObjSuf        = obj
SrcSuf        = cxx
ExeSuf        = exe
DllSuf        = dll
OutPutOpt     = -out:

# Win32 system with Microsoft Visual C/C++
!include <win32.mak>

# Compilation options (debug/release)
!include "..\option.mak"

INCFLAGS       = -I$(ROOTSYS)/include

CC            = $(cc)
CXX           = $(cc)
CXXFLAGS      = $(CXXOPT) $(cvarsdll) -nologo -G5 -GR -MD -DWIN32 -DVISUAL_CPLUSPLUS -D_WINDOWS -D_FINANCE_ $(INCFLAGS)

LD            = $(link)
LDFLAGS       = $(LDOPT) $(conlflags) -nologo -pdb:none
SOFLAGS       = $(dlllflags:-pdb:none=)
ROOTLIBS      = $(ROOTSYS)/lib/libCore.lib \
                $(ROOTSYS)/lib/libCint.lib $(ROOTSYS)/lib/libHist.lib \
                $(ROOTSYS)/lib/libGraf.lib $(ROOTSYS)/lib/libGraf3d.lib \
                $(ROOTSYS)/lib/libGpad.lib $(ROOTSYS)/lib/libTree.lib \
                $(ROOTSYS)/lib/libRint.lib $(ROOTSYS)/lib/libPostscript.lib \
                $(ROOTSYS)/lib/libMatrix.lib $(ROOTSYS)/lib/libPhysics.lib \
                $(ROOTSYS)/lib/libGui.lib


LIBS          = $(ROOTLIBS) $(QTLIBS) $(RQUANTLIBS) $(guilibsdll) MSVCIRT.LIB

#------------------------------------------------------------------------------

RQUANTO       = test.$(ObjSuf)

RQUANT        = test.$(ExeSuf)

$(RQUANT): 	$(RQUANTO)
		$(LD) $(LDFLAGS) $(RQUANTO) $(LIBS) $(OutPutOpt)$(RQUANT)
		@echo "RQUANT done"



# ---------------------------------- RQUANT ----------------------------------------------------


# RQuant

test.$(ObjSuf) : test.cxx
		$(CXX) test.cxx $(CXXFLAGS) -c



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:41 MET