This script shows how to make a simple iterative server that can receive TMemFile from multiple clients and merge them into a single file without block.
Note: This server assumes that the client will reset the histogram after each upload to simplify the merging.
This server can accept connections while handling currently open connections. Compare this script to hserv.C that blocks on accept. In this script a server socket is created and added to a monitor. A monitor object is used to monitor connection requests on the server socket. After accepting the connection the new socket is added to the monitor and immediately ready for use. Once two connections are accepted the server socket is removed from the monitor and closed. The monitor continues monitoring the sockets.
To run this demo do the following:
- Open three windows
- Start ROOT in all three windows
- Execute in the first window: .x fastMergerServer.C
- Execute in the second and third windows: .x treeClient.C
return;
}
};
while (true) {
printf(
"only accept 100 clients connections\n");
} else {
}
continue;
}
Error(
"fastMergeServer",
"The client did not send a message\n");
char str[64];
mess->ReadString(str, 64);
printf(
"No more active clients... stopping\n");
break;
}
delete transient;
merger.AddAdoptFile(transient);
transient = nullptr;
printf(
"got object of class: %s\n",
mess->GetClass()->GetName());
} else {
printf(
"*** Unexpected message ***\n");
}
}
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
A cache when writing files over the network.
This class provides file copy and merging services.
@ kAllIncremental
Merge incrementally all type of objects.
A TMemFile is like a normal TFile except that it reads and writes only from memory.
UInt_t GetBytesRecv() const
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
UInt_t GetBytesSent() const
virtual void Close(Option_t *opt="")
Close the socket.
TClass * IsA() const override
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
- Author
- Fons Rademakers
Definition in file fastMergeServer.C.