Index: trunk/AddOn/TAcq/racqueth.cc
===================================================================
--- trunk/AddOn/TAcq/racqueth.cc	(revision 3757)
+++ trunk/AddOn/TAcq/racqueth.cc	(revision 3758)
@@ -42,7 +42,8 @@
 
   char msg[BRTCPMSGLEN];
+  cout << "PCIEToEthernet/Info: Establishing TCP/IP connections ... " << endl;
   for(size_t i=0; i<vec_pciw_.size(); i++) {
     vector<ClientSocket> vskt;
-    for(size_t j=0; j<vskt.size(); j++) {
+    for(size_t j=0; j<destname_.size(); j++) {
       ClientSocket sok(destname_[j], tcpportid_);
       for(int ii=0; ii<BRTCPMSGLEN; ii++) msg[ii]='\0';
@@ -57,4 +58,5 @@
     vvec_skt_.push_back(vskt);    
   }
+  totrdsnd_ = 0;
 }
 
@@ -74,5 +76,4 @@
   struct timeval tv1,tv2;
   gettimeofday(&tv1, NULL);
-  uint_8 totrdsnd = 0;
   
   cout << " PCIEToEthernet::run() - Starting , NMaxMemZones=" <<  par_.MaxNbBlocs()
@@ -83,5 +84,5 @@
   // sigaddset(&act.sa_mask,SIGINT);  // pour proteger le transfert DMA
   //sigaction(SIGINT,&act,NULL);  	
-  uint_4 paqszmm = par_.MMgrNbPaquet();
+  uint_4 paqszmm = par_.MMgrPaquetSize();
   uint_4 paqsz =  packSize_;
   uint_4 dmasz = vec_pciw_[0]->TransferSize();
@@ -103,4 +104,6 @@
   // Initialisation des tampons pour recopie des paquets a cheval pour chaque DMA
   for (int i=0;i< (int)nbDma_ ;i++) {  
+    //    cout << " DEBUG*AB paqsz=" << paqsz << " paqszmm=" << paqszmm << endl;
+    tampon[i]=nexpaq[i]=NULL;
     tampon[i] = new Byte[paqsz];
     nexpaq[i] = new Byte[paqszmm];
@@ -131,9 +134,12 @@
     for(size_t j=0; j<vskt.size(); j++) {
       for(int ii=0; ii<BRTCPMSGLEN; ii++) msg[ii]='\0';
-      vskt[i].Receive(msg,BRTCPMSGLEN);
-      if (strncmp(msg,"BAORadio-EthernetReader-Ready-GO",32)!=0)
+      vskt[j].Receive(msg,BRTCPMSGLEN);
+      if (strncmp(msg,"BAORadio-EthernetReader-Ready-GO",32)!=0) {
+	msg[BRTCPMSGLEN-1]='\0';
+	cout << "PCIEToEthernet:ERROR BAD Go for fiber=" << i << " dest=" << j << " msg: " << msg << endl;
 	throw SocketException("PCIEToEthernet:ERROR/  BAD Go message from EthernetReader ");
-    }
-    cout << " PCIEToEthernet::run() Received GO message for Fiber/DMA " << i << " from " << destname_[i] << endl;
+      }
+    cout << " PCIEToEthernet::run() Received GO message for Fiber/DMA " << i << " from " << destname_[j] << endl;
+    }
   }
 
@@ -165,11 +171,9 @@
     }
     if (fgbaddma) continue;  
+
     if (fgdirectsend) {  // Pas de copie / reduction de taille de paquet, on rebalance tel quel ...
       for (int fib=0; fib<(int) nbDma_ ;fib++) {
-	vector<ClientSocket>& vskt = vvec_skt_[fib];
-	for(size_t j=0; j<vskt.size(); j++) {
-	  vskt[j].Send((const char *)Datas[fib], dmasz);
-	  totrdsnd += dmasz;
-	}
+	//DBG cout << " DEBUG*B fib=" << fib << " Datas[fib]=" << hex << Datas[fib] << dec << endl; 
+	SendToTargets(fib, Datas[fib], dmasz);
 	trnbytes[fib] += (uint_8)dmasz;
 	npaqfait[fib] += (trnbytes[fib]/(uint_8)paqszmm);
@@ -179,4 +183,5 @@
       continue;  // On bypasse le reste 
     }
+
     // Si on arrive ici, c'est qu'il faut copier / reduire les paquets ....
     uint_4 curoff=0;
@@ -205,9 +210,5 @@
 	  }
 	  BRPaquet paq(nexpaq[fib], packSizeInMgr_);
-	  vector<ClientSocket>& vskt = vvec_skt_[fib];
-	  for(size_t j=0; j<vskt.size(); j++) {
-	    vskt[j].Send((const char *)nexpaq[fib], packSizeInMgr_);
-	    totrdsnd += packSizeInMgr_;
-	  }
+	  SendToTargets(fib, nexpaq[fib], packSizeInMgr_);
 	  npaqfait[fib]++;
 	  if (fib==nbDma_-1) npaqfaitg++;  // Ne pas oublier le compteur de paquets faits 
@@ -244,9 +245,5 @@
 	  }
 	  BRPaquet paq(nexpaq[fib], packSizeInMgr_);
-	  vector<ClientSocket>& vskt = vvec_skt_[fib];
-	  for(size_t j=0; j<vskt.size(); j++) {
-	    vskt[j].Send((const char *)nexpaq[fib], packSizeInMgr_);
-	    totrdsnd += packSizeInMgr_;
-	  }
+	  SendToTargets(fib, nexpaq[fib], packSizeInMgr_);
 	  npaqfait[fib]++;
 	  if (fib==nbDma_-1) npaqfaitg++;  // Ne pas oublier le compteur de paquets faits 
@@ -269,5 +266,5 @@
   if (tmelaps2<0.1) tmelaps2=0.1; 
   cout << " ---------- PCIEToEthernet::run()-End summary NPaqFait=" << npaqfaitg 
-       << " TotSend (kb)=" << totrdsnd/1024 << "------ " << endl;
+       << " TotSend (kb)=" << totrdsnd_/1024 << "------ " << endl;
   for (int dma=0; dma < (int)nbDma_ ;dma++)   {
     cout << " --Fib=" << dma << " NPaqFait=" << npaqfait[dma] <<  " TotDMATransfer=" 
@@ -305,5 +302,17 @@
 }
 
-
+static long cnt_prt=0;
+/* --Methode-- */
+size_t PCIEToEthernet::SendToTargets(int fib, Byte* data, size_t len)
+{
+  //DBG   cout << " SendToTargets/DBG" << cnt_prt << " len=" << len << " data=" << hex << (unsigned long)data << dec << endl; cnt_prt++; 
+  vector<ClientSocket>& vskt = vvec_skt_[fib];
+  size_t rc=0;
+  for(size_t j=0; j<vskt.size(); j++) {
+    rc += vskt[j].Send((const char *)data, len);
+    totrdsnd_ += len;
+  }
+  return rc;
+}
 //------------------------------------------------------------------
 // Classe thread de lecture sur interface reseau (Ethernet) 
@@ -369,4 +378,5 @@
     strcpy(msg,"BAORadio-EthernetReader-Ready-GO");
     for(size_t fib=0; fib<(size_t)memgr_.NbFibres(); fib++) {
+      cout << " EthernetReader/Debug - Sending GO message to sender " << fib << endl;
       vsok_[fib].Send(msg,BRTCPMSGLEN);
     }
