when using userReceiver with many instances of the receiver in one program, the index will keep increasing, hence need to adjust zmq port and det index in file name

This commit is contained in:
Dhanya Maliakal 2017-06-22 12:27:17 +02:00
parent 1dc774d229
commit 98cb8de478
3 changed files with 5 additions and 2 deletions

View File

@ -44,7 +44,7 @@ class BinaryFileStatic {
{
ostringstream osfn;
osfn << fpath << "/" << fnameprefix;
if (dindex >= 0) osfn << "_d" << (dindex * numunits + unitindex);
if (dindex >= 0) osfn << "_d" << ((unitindex >= numunits) ? unitindex : (dindex * numunits + unitindex)); //if unit index > numunits, all receivers in one program (userReceiver)
if (frindexenable) osfn << "_f" << setfill('0') << setw(12) << fnum;
osfn << "_" << findex;
osfn << ".raw";

View File

@ -50,7 +50,7 @@ public:
{
ostringstream osfn;
osfn << fpath << "/" << fnameprefix;
if (dindex >= 0) osfn << "_d" << (dindex * numunits + unitindex);
if (dindex >= 0) osfn << "_d" << ((unitindex >= numunits) ? unitindex : (dindex * numunits + unitindex)); //if unit index > numunits, all receivers in one program (userReceiver)
if (frindexenable) osfn << "_f" << setfill('0') << setw(12) << fnum;
osfn << "_" << findex;
osfn << ".h5";

View File

@ -160,6 +160,9 @@ int DataStreamer::SetThreadPriority(int priority) {
int DataStreamer::CreateZmqSockets(int* dindex, int* nunits) {
uint32_t portnum = DEFAULT_ZMQ_PORTNO + ((*dindex) * (*nunits) + index);
//using userReceiver where all receivers in one program (numberofstreamers>*nunits)
if(index >= *nunits)
portnum = DEFAULT_ZMQ_PORTNO + index;
zmqSocket = new ZmqSocket(portnum);
if (zmqSocket->IsError()) {