Client program which allows the snooping of objects from a spyserv process.
To run this demo do the following (see spyserv.C):
- open two or more windows
- start root in all windows
- execute in the first window: .x spyserv.C (or spyserv.C++)
- execute in the other window(s): .x spy.C (or spy.C++)
- in the "spy" client windows click the "Connect" button and snoop the histograms by clicking on the "hpx", "hpxpy" and "hprof" buttons
class Spy {
private:
public:
Spy();
~Spy();
void Connect();
void DoButton();
};
void Spy::DoButton()
{
return;
case 1:
break;
case 2:
fSock->
Send(
"get hpxpy");
break;
case 3:
fSock->
Send(
"get hprof");
break;
}
if (fSock->
Recv(mess) <= 0) {
Error(
"Spy::DoButton",
"error receiving message");
return;
}
if (fHist) delete fHist;
else
}
delete mess;
}
void Spy::Connect()
{
fSock =
new TSocket(
"localhost", 9090);
}
Spy::Spy()
{
fMain->AddFrame(fCanvas, fLcan);
fMain->AddFrame(fHorz, fLhorz);
fHpx->
Connect(
"Clicked()",
"Spy",
this,
"DoButton()");
fHpxpy->
Connect(
"Clicked()",
"Spy",
this,
"DoButton()");
fHprof->
Connect(
"Clicked()",
"Spy",
this,
"DoButton()");
fMain->AddFrame(fHorz2, fLhorz);
fConnect->
Connect(
"Clicked()",
"Spy",
this,
"Connect()");
fMain->SetWindowName("Spy on SpyServ");
fMain->MapSubwindows();
fMain->Resize(fMain->GetDefaultSize());
fMain->MapWindow();
fHist = 0;
}
Spy::~Spy()
{
delete fHist;
delete fSock;
delete fLbut;
delete fLhorz;
delete fLcan;
delete fHpx;
delete fHpxpy;
delete fHprof;
delete fConnect;
delete fQuit;
delete fHorz;
delete fHorz2;
delete fCanvas;
delete fMain;
}
void spy()
{
new Spy;
}
- Author
- Fons Rademakers
Definition in file spy.C.