Index: trunk/AddOn/TAcq/tsok.cc
===================================================================
--- trunk/AddOn/TAcq/tsok.cc	(revision 3542)
+++ trunk/AddOn/TAcq/tsok.cc	(revision 3544)
@@ -17,7 +17,12 @@
 
 void burawtst(); 
-void serverside(); 
-void clientside(string& servname, string& msg, string& args);
-
+int serverside(); 
+int clientside(string& servname, string& msg, string& args);
+
+static size_t RIOS_NPAQ = 16;
+ 
+//---------------------------------------------------------------------------
+//  main program de test des classes socket  - R. Ansari 2005-2008
+//---------------------------------------------------------------------------
 int main(int narg, char *arg[])
 {
@@ -25,7 +30,7 @@
   if (narg < 2) {
     cout << " Erreur Argument / tsok.cc : Socket class tests \n" 
-         << "    Usage : tsok S/C [servername=localhost] [OPEMsg=Hello] [NLoop,SizeX,SizeY] \n" 
+         << "    Usage : tsok S/C [servername=localhost] [OPEMsg=Hello] [NLoop,SizeX,SizeY] [RIOS_NPaq=16]\n" 
          << "    Ex: tsok S   or  tsok C serverName or \n" 
-         << "        tsok C serverName PPFSOCKET  5  1000,1000 \n" 
+         << "        tsok C serverName PPFSOCKET  5,1000,800 \n" 
          << "   S : run tsok as server side \n" 
          << "   C : run tsok as client side \n"
@@ -43,27 +48,34 @@
   string oargs = "1,100,50";
   if (narg > 4) oargs = arg[4];
-
+  if (narg > 5) RIOS_NPAQ = atol(arg[5]);
+
+  int rc = 0;
   try {
     SophyaInit();  
     InitTim(); 
-    if (fgserv) serverside();
-    else if (*arg[1] == 'C') clientside(servname, opemsg, oargs);
+    if (fgserv) rc=serverside();
+    else if (*arg[1] == 'C') rc=clientside(servname, opemsg, oargs);
     else burawtst();
   }
   catch(PThrowable exc ) {
     cerr << "tsok-main() , Catched exception: \n" << exc.Msg() << endl;
+    rc=97;
   }
   catch(std::exception ex) {
     cerr << "tsok-main() , Catched std::exception " << (string)(ex.what()) << endl;
+    rc=98;
   }
   catch(...) {
     cerr << "tsok-main() , Catched ... ! " << endl;
-  }
+    rc=99;
+  }
+  cout << " --------- End of tsok.cc Rc=" << rc << " ---------------- " << endl;
 }
 
 
 /* --Fonction-- */
-void serverside()
-{
+int serverside()
+{
+  int rc = 66;
   cout << " ======== tsok.cc / ServerSide ============ " << endl;
   cout << " Creating server socket ... , PortId= " << PORTID << endl;
@@ -104,5 +116,5 @@
 	//	sleep(1);
           {
-	  RawInOutSocketStream sstr(skt);
+	  RawInOutSocketStream sstr(skt, RIOS_NPAQ);
 	  PInPersist pis(&sstr, false, false);
 	  pis.GetObject(mx);
@@ -113,5 +125,5 @@
 	  {
           // cout << " --- writing back modified mx to socket stream ... " << endl;
-	  RawInOutSocketStream sstr(skt);
+	  RawInOutSocketStream sstr(skt, RIOS_NPAQ);
 	  POutPersist pos(&sstr, false);
 	  pos.PutObject(mx);
@@ -132,11 +144,14 @@
     cout << "ServerSide: Closing current socket ..." << endl;
     skt.Close();
+    rc = 0;
   }  // fin while(!fgstop)
   cout << " ======= End of tsok.cc / ServerSide ======== " << endl;
+  return rc;
 }
 
 /* --Fonction-- */
-void clientside(string& servname, string& msg, string& args)
-{
+int clientside(string& servname, string& msg, string& args)
+{
+  int rc = 77;
   cout << " ======== tsok.cc / ClientSide ============ " << endl;
   cout << "  ServerName= " << servname << " OpeMsg= " << msg << endl;
@@ -150,5 +165,7 @@
   cout << "  Sending Message : " << buff << endl;
   cli.Send(buff, 256);
+  rc = 0;
   if (msg == "PPFSOCKET") {
+    rc = 7;
     int nloop = 1;
     int sx = 100;
@@ -170,5 +187,5 @@
       {
       // cout << " --- writing mx to socket stream ... " << endl;
-      RawInOutSocketStream sstr(cli);
+      RawInOutSocketStream sstr(cli, RIOS_NPAQ);
       POutPersist pos(&sstr, false);
       pos.PutObject(mx);
@@ -176,5 +193,5 @@
       TMatrix<int_4> mxr;
       {
-      RawInOutSocketStream sstr(cli);
+      RawInOutSocketStream sstr(cli, RIOS_NPAQ);
       PInPersist pis(&sstr, false, false);
       pis.GetObject(mxr);
@@ -197,4 +214,6 @@
     }
     cout << "ClientSide/End of PPFSocket  NPb-Check-returnMatrix=" << npb << " /NLoop=" << nloop << endl;  
+    if (npb==0) rc=0;
+    else rc=70;
     float ttms  = tm.TotalElapsedTime();
     if (ttms < 1.e-6) ttms = 1e-6;
@@ -205,4 +224,5 @@
   cli.Send(buff, 256);
   cout << " ======= End of tsok.cc / ClientSide ======== " << endl;
+  return rc;
 }
 
