I’d like run a network servers and clients.
see files in attachment
In a root server session i’d like to run this lines
.L ServerRoot.C++
TH1S* histo1= new TH1S(“Histo1”,“histo1”,10,0,10);
TH1S* histo2= new TH1S(“Histo2”,"histo2 ",10,0,10);
for (int i = 0;i<10;i++){histo1 ->Fill(i,i);histo2 ->Fill(i,10-i);}
ServerRoot* serv1 = new ServerRoot();
serv1->SetPort(9090);
ServerRoot* serv2 = new ServerRoot();
serv1->SetPort(9091);
after looking at the ServerRoot.C is looks like you don’t need the read thread as you could do it all with just a single TMonitor (see example $ROOTSYS/tutorials/net/hserv.C). And if you want to use a reader thread you won’t need a TMonitor, just do socket->Recv(). I think the random behaviour is due to the fact that TMonitor is not thread save and that you have tow threads calling it without mutex.
just look at hserv.C, I think you can make you code without thread, but just a TMonitor (which is a select) on the multiple sockets. If you want a thread you won’t need a TMonitor, just call sock->Recv() and wait till you get something.