How to stop properly a TServerSocket running in a TThread

From: Legeard Luc <legeard_at_ganil.fr>
Date: Mon, 05 Feb 2007 18:15:11 +0100

Hello Rooters

I 'd like to run a histograms server on a network. I' d like also stop it and restart it when i want.

So to do that, i 've done a example of server and client given in attached files .
I can used like that
1) Running the server in a root session and define the object to be served ( in this case , it's histograms)

root [0] gROOT->LoadMacro("ServerRoot.C++");
root [1] TH1S* histo1= new TH1S("Histo1","histo1",10,0,10);
root [2] TH1S* histo2= new TH1S("Histo2","histo2 ",10,0,10);
root [3] for (int i = 0;i<10;i++){histo1 ->Fill(i,i);histo2 ->Fill(i,10-i);}
root [4] ServerRoot* serv = new ServerRoot();
root [5] serv ->StartGNetServer();
root [6] serv ->SetSpectra(histo1); // to serve histo1
......
root [10] serv ->SetSpectra(histo2);// to serve histo1

2) Running a client in a other Root session

root [0] gROOT->LoadMacro("ClientRoot.C++");
root [2] ClientRoot* client =new ClientRoot();
root [3] client->Open();
root [4] client->TestServer();

root [5] TH1* hista1= client->GetSpectrum();

root [6] hista1 -> Draw();
root [7] client->Close();

All this runs if we don't try to stop server:

root [16] serv ->StopGNetServer();


         Net Server stopped
        *********************

root [17]

Thread 1 (Thread -1208400192 (LWP 25190)):
#0 0x00192410 in __kernel_vsyscall ()
#1 0x074e40db in __waitpid_nocancel () from /lib/libc.so.6
#2 0x0748cda7 in do_system () from /lib/libc.so.6
#3 0x0748d138 in system () from /lib/libc.so.6
#4 0x001773d5 in system () from /lib/libpthread.so.0
#5 0x006f7ee7 in TUnixSystem::Exec () from
/usr/global/root/root5.14//lib/libCore.so
#6 0x006ffb86 in TUnixSystem::StackTrace () from
/usr/global/root/root5.14//lib/libCore.so
#7 0x006fef63 in TUnixSystem::DispatchSignals () from
/usr/global/root/root5.14//lib/libCore.so
#8 0x006ff0f1 in SigHandler () from

/usr/global/root/root5.14//lib/libCore.so
#9 0x006f8d5c in sighandler () from

/usr/global/root/root5.14//lib/libCore.so
#10 <signal handler called>
#11 0x00bd4d68 in vtable for TString () from
/usr/global/root/root5.14//lib/libCore.so
#12 0x006d0b91 in TMonitor::SetReady () from
/usr/global/root/root5.14//lib/libCore.so
#13 0x006d0be3 in TTimeOutTimer::Notify () from
/usr/global/root/root5.14//lib/libCore.so
#14 0x0062646b in TTimer::CheckTimer () from
/usr/global/root/root5.14//lib/libCore.so
#15 0x006fad99 in TUnixSystem::DispatchTimers () from
/usr/global/root/root5.14//lib/libCore.so
#16 0x006ff56c in TUnixSystem::DispatchOneEvent () from
/usr/global/root/root5.14//lib/libCore.so
#17 0x00619714 in TSystem::InnerLoop () from
/usr/global/root/root5.14//lib/libCore.so
#18 0x006196ba in TSystem::Run () from

/usr/global/root/root5.14//lib/libCore.so
#19 0x00598757 in TApplication::Run () from
/usr/global/root/root5.14//lib/libCore.so
#20 0x0011d565 in TRint::Run () from

/usr/global/root/root5.14//lib/libRint.so Root >

I don't understand where can be my mistake! Have you a idea?

Thanks a lot

Luc

-- 
 ------------------------------------------------------------
 -  Luc LEGEARD                  - Tel   : 02 31 45 44 36   -
 -  GANIL  BP 55027 Bd Becquerel - Fax   : 02 31 45 47 97   -
 -  14076 CAEN Cedex 5           - mailto:legeard_at_ganil.fr  -
 -  Web http://www.ganil.fr


Received on Mon Feb 05 2007 - 18:15:41 CET

This archive was generated by hypermail 2.2.0 : Tue Feb 06 2007 - 11:50:00 CET