Salome HOME
- Major update for launcher:
[modules/kernel.git] / src / Communication / SALOME_Comm_i.cxx
index c22771c90774866ec6767f75ffffdb901976a2d1..3eefce56cf597ca9a260ea1aa923e449c0a1472a 100644 (file)
@@ -1,36 +1,38 @@
-// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either 
-// version 2.1 of the License.
-// 
-// This library is distributed in the hope that it will be useful 
-// but WITHOUT ANY WARRANTY; without even the implied warranty of 
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-// Lesser General Public License for more details.
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-// You should have received a copy of the GNU Lesser General Public  
-// License along with this library; if not, write to the Free Software 
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
 //
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
 #include "SALOME_Comm_i.hxx"
-#ifndef WNT
+#ifndef WIN32
 #include <rpc/xdr.h>
 #endif
-#include "poa.h"
+#include "omniORB4/poa.h"
 #include "omnithread.h"
 #include "Utils_SINGLETON.hxx"
 #include "Utils_ORB_INIT.hxx"
 #include "utilities.h"
 
 #include "SenderFactory.hxx"
-using namespace std;
 
-#ifndef WNT
+#ifndef WIN32
 CORBA::ORB_var &getGlobalORB(){
   ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
   CORBA::ORB_var &orb = init(0,0);
@@ -376,7 +378,7 @@ std::string SALOME_SocketSender_i::inetAddress()
       host = gethostbyname(s);
       if (host != NULL)
          inet_ntop(AF_INET, (struct in_addr *) *host->h_addr_list, 
-                  t, INET_ADDRSTRLEN);
+                   t, INET_ADDRSTRLEN);
    }
    return std::string(t);
 }
@@ -430,19 +432,19 @@ void* SALOME_SocketSender_i::myThread(void *args)
 
       *errorFlag = false;
       while( n < *lgrTabToSend*sizeof(double) ){
-       m = write(*clientSockfd, (char*)tabToSend+n, *lgrTabToSend*sizeof(double)-n);
-       if( m < 0 ){
-         if( *clientSockfd >= 0 ){
-           ::close(*clientSockfd);
-           *clientSockfd = -1;
-         }
-         if( *serverSockfd >= 0 ){
-           ::close(*serverSockfd);
-           *serverSockfd = -1;
-         }
-         *errorFlag = true;
-       }
-       n += m;
+        m = write(*clientSockfd, (char*)tabToSend+n, *lgrTabToSend*sizeof(double)-n);
+        if( m < 0 ){
+          if( *clientSockfd >= 0 ){
+            ::close(*clientSockfd);
+            *clientSockfd = -1;
+          }
+          if( *serverSockfd >= 0 ){
+            ::close(*serverSockfd);
+            *serverSockfd = -1;
+          }
+          *errorFlag = true;
+        }
+        n += m;
       }
       xdr_destroy( &xp );
 
@@ -456,19 +458,19 @@ void* SALOME_SocketSender_i::myThread(void *args)
 
       *errorFlag = false;
       while( n < *lgrTabToSend*sizeof(int) ){
-       m = write(*clientSockfd, (char*)tabToSend+n, *lgrTabToSend*sizeof(int)-n);
-       if( m < 0 ){
-         if( *clientSockfd >= 0 ){
-           ::close(*clientSockfd);
-           *clientSockfd = -1;
-         }
-         if( *serverSockfd >= 0 ){
-           ::close(*serverSockfd);
-           *serverSockfd = -1;
-         }
-         *errorFlag = true;
-       }
-       n += m;
+        m = write(*clientSockfd, (char*)tabToSend+n, *lgrTabToSend*sizeof(int)-n);
+        if( m < 0 ){
+          if( *clientSockfd >= 0 ){
+            ::close(*clientSockfd);
+            *clientSockfd = -1;
+          }
+          if( *serverSockfd >= 0 ){
+            ::close(*serverSockfd);
+            *serverSockfd = -1;
+          }
+          *errorFlag = true;
+        }
+        n += m;
       }
       xdr_destroy( &xp );
 
@@ -500,7 +502,7 @@ void SALOME_SocketSender_i::initCom() throw(SALOME::SALOME_Exception)
 
   /* Association of socket with a port */
   if( ::bind(_serverSockfd, (struct sockaddr *) & serv_addr, 
-          sizeof(struct sockaddr)) < 0 ) {
+           sizeof(struct sockaddr)) < 0 ) {
     closeCom();
     es.type = SALOME::COMM;
     es.text = "error bind Socket exception";