Back to index

salome-kernel  6.5.0
SALOME_Comm_i.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #include "SALOME_Comm_i.hxx"
00024 #ifndef WIN32
00025 #include <rpc/xdr.h>
00026 #endif
00027 #include "omniORB4/poa.h"
00028 #include "omnithread.h"
00029 #include "Utils_SINGLETON.hxx"
00030 #include "Utils_ORB_INIT.hxx"
00031 #include "utilities.h"
00032 
00033 #include "SenderFactory.hxx"
00034 
00035 #ifndef WIN32
00036 CORBA::ORB_var &getGlobalORB(){
00037   ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
00038   CORBA::ORB_var &orb = init(0,0);
00039   return orb;
00040 }
00041 #endif
00042 
00046 const void *SALOME_Sender_i::getData(long &size) const{
00047   size=_lgrTabToSend;
00048   return _tabToSend;
00049 }
00050 
00053 int SALOME_Sender_i::getSizeOf() const {
00054   return _sizeOf;
00055 }
00056 
00058 SALOME_Sender_i::SALOME_Sender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend):_tabToSend(tabToSend),_lgrTabToSend(lgrTabToSend),_sizeOf(sizeOf),_ownTabToSend(ownTabToSend){
00059 }
00060 
00062 void SALOME_Sender_i::setOwnerShip(bool own)
00063 {
00064   _ownTabToSend=own;
00065 }
00066 
00069 void SALOME_Sender_i::release()
00070 {
00071   PortableServer::ObjectId_var oid = _default_POA()->servant_to_id(this);
00072   _default_POA()->deactivate_object(oid);
00073   _remove_ref();
00074 }
00075 
00076 SALOME_SenderDouble_i::SALOME_SenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend):SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(double),ownTabToSend)
00077 {
00078 }
00079 
00082 SALOME_SenderDouble_i::~SALOME_SenderDouble_i()
00083 {
00084   if(_ownTabToSend)
00085     delete [] (double *)_tabToSend;
00086 }
00087 
00090 SALOME::SenderDouble_ptr SALOME_SenderDouble_i::buildOtherWithProtocol(SALOME::TypeOfCommunication type)
00091 {
00092   return SenderFactory::buildSender(type,this);
00093 }
00094 
00098 SALOME_SenderDouble_i *SALOME_SenderDouble_i::find(SALOME::SenderDouble_ptr pCorba){
00099   PortableServer::ServantBase *ret;
00100   try {
00101     ret=PortableServer::POA::_the_root_poa()->reference_to_servant(pCorba);
00102   }
00103   catch(...){
00104     return 0;
00105   }
00106   ret->_remove_ref();
00107   return dynamic_cast<SALOME_SenderDouble_i *>(ret);
00108 }
00109 
00110 SALOME_SenderInt_i::SALOME_SenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend):SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(int),ownTabToSend)
00111 {
00112 }
00113 
00116 SALOME_SenderInt_i::~SALOME_SenderInt_i()
00117 {
00118   if(_ownTabToSend)
00119     delete [] (int *)_tabToSend;
00120 }
00121 
00124 SALOME::SenderInt_ptr SALOME_SenderInt_i::buildOtherWithProtocol(SALOME::TypeOfCommunication type)
00125 {
00126   return SenderFactory::buildSender(type,this);
00127 }
00128 
00132 SALOME_SenderInt_i *SALOME_SenderInt_i::find(SALOME::SenderInt_ptr pCorba){
00133   PortableServer::ServantBase *ret;
00134   try {
00135     ret=PortableServer::POA::_the_root_poa()->reference_to_servant(pCorba);
00136   }
00137   catch(...){
00138     return 0;
00139   }
00140   ret->_remove_ref();
00141   return dynamic_cast<SALOME_SenderInt_i *>(ret);
00142 }
00143 
00144 SALOME_CorbaDoubleNCSender_i::SALOME_CorbaDoubleNCSender_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend):SALOME_SenderDouble_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(double),ownTabToSend){
00145 }
00146 
00147 SALOME_CorbaDoubleNCSender_i::~SALOME_CorbaDoubleNCSender_i(){
00148 }
00149 
00150 CORBA::ULong SALOME_CorbaDoubleNCSender_i::getSize(){
00151   CORBA::ULong ret=_lgrTabToSend;
00152   return ret;
00153 }
00154 
00155 SALOME::vectorOfDouble* SALOME_CorbaDoubleNCSender_i::sendPart(CORBA::ULong offset, CORBA::ULong length){
00156   SALOME::vectorOfDouble_var c1 = new SALOME::vectorOfDouble(length,length,(CORBA::Double *)((double *)_tabToSend+(long)offset),0);
00157   return c1._retn();
00158 }
00159 
00160 SALOME::vectorOfDouble* SALOME_CorbaDoubleNCSender_i::send(){
00161   SALOME::vectorOfDouble_var c1 = new SALOME::vectorOfDouble(_lgrTabToSend,_lgrTabToSend,(CORBA::Double *)_tabToSend,0);
00162   return c1._retn();
00163 }
00164 
00165 SALOME_CorbaDoubleCSender_i::SALOME_CorbaDoubleCSender_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend):SALOME_SenderDouble_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(double),ownTabToSend){
00166 }
00167 
00168 SALOME_CorbaDoubleCSender_i::~SALOME_CorbaDoubleCSender_i(){
00169 }
00170 
00171 CORBA::ULong SALOME_CorbaDoubleCSender_i::getSize(){
00172   CORBA::ULong ret=_lgrTabToSend;
00173   return ret;
00174 }
00175 
00176 SALOME::vectorOfDouble* SALOME_CorbaDoubleCSender_i::sendPart(CORBA::ULong offset, CORBA::ULong length){
00177   SALOME::vectorOfDouble_var c1 = new SALOME::vectorOfDouble;
00178   c1->length(length);
00179   for (long i=0; i<length; i++)
00180     c1[i] = ((double *)_tabToSend)[i+offset];
00181   return c1._retn();
00182 }
00183 
00185 
00186 SALOME_CorbaLongNCSender_i::SALOME_CorbaLongNCSender_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend):SALOME_SenderInt_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(int),ownTabToSend){
00187 }
00188 
00189 SALOME_CorbaLongNCSender_i::~SALOME_CorbaLongNCSender_i(){
00190 }
00191 
00192 CORBA::ULong SALOME_CorbaLongNCSender_i::getSize(){
00193   CORBA::ULong ret=_lgrTabToSend;
00194   return ret;
00195 }
00196 
00197 SALOME::vectorOfLong* SALOME_CorbaLongNCSender_i::sendPart(CORBA::ULong offset, CORBA::ULong length){
00198   SALOME::vectorOfLong_var c1 = new SALOME::vectorOfLong(length,length,(CORBA::Long *)((long *)_tabToSend+(long)offset),0);
00199   return c1._retn();
00200 }
00201 
00202 SALOME::vectorOfLong* SALOME_CorbaLongNCSender_i::send(){
00203   SALOME::vectorOfLong_var c1 = new SALOME::vectorOfLong(_lgrTabToSend,_lgrTabToSend,(CORBA::Long *)_tabToSend,0);
00204   return c1._retn();
00205 }
00206 
00207 SALOME_CorbaLongCSender_i::SALOME_CorbaLongCSender_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend):SALOME_SenderInt_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(int),ownTabToSend){
00208 }
00209 
00210 SALOME_CorbaLongCSender_i::~SALOME_CorbaLongCSender_i(){
00211 }
00212 
00213 CORBA::ULong SALOME_CorbaLongCSender_i::getSize(){
00214   CORBA::ULong ret=_lgrTabToSend;
00215   return ret;
00216 }
00217 
00218 SALOME::vectorOfLong* SALOME_CorbaLongCSender_i::sendPart(CORBA::ULong offset, CORBA::ULong length){
00219   SALOME::vectorOfLong_var c1 = new SALOME::vectorOfLong;
00220   c1->length(length);
00221   for (long i=0; i<length; i++)
00222     c1[i] = ((long *)_tabToSend)[i+offset];
00223   return c1._retn();
00224 }
00225 
00226 #ifdef HAVE_MPI2
00227 
00228 unsigned long SALOME_MPISender_i::_tag1=0;
00229 
00230 unsigned long SALOME_MPISender_i::_tag2=1;
00231 
00232 SALOME_MPISender_i::SALOME_MPISender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend):SALOME_Sender_i(tabToSend,lgrTabToSend,sizeOf,ownTabToSend){
00233   _portName=new char[MPI_MAX_PORT_NAME];
00234 }
00235 
00236 SALOME_MPISender_i::~SALOME_MPISender_i(){
00237   delete [] _portName;
00238 }
00239 
00240 SALOME::MPISender::param* SALOME_MPISender_i::getParam()
00241 {
00242   char stag[12];
00243   int i=0;
00244 
00245   SALOME::MPISender::param_var p = new SALOME::MPISender::param;
00246   MPI_Comm_rank(MPI_COMM_WORLD,&_cproc);
00247   p->myproc = _cproc;
00248   p->tag1 = _tag1;
00249   _tag1Inst=_tag1;
00250   p->tag2 =_tag2;
00251   _tag2Inst=_tag2;
00252   std::string service("toto_");
00253   sprintf(stag,"%d_",_tag1);
00254   service += stag;
00255   sprintf(stag,"%d_",p->tag2);
00256   service += stag;
00257   p->service = CORBA::string_dup(service.c_str());
00258   MPI_Open_port(MPI_INFO_NULL, _portName);
00259   MPI_Errhandler_set(MPI_COMM_WORLD,MPI_ERRORS_RETURN);
00260   while ( i != TIMEOUT  && MPI_Publish_name((char*)service.c_str(),MPI_INFO_NULL,_portName) != MPI_SUCCESS) {
00261     i++;
00262   } 
00263   MPI_Errhandler_set(MPI_COMM_WORLD,MPI_ERRORS_ARE_FATAL);
00264   if ( i == TIMEOUT  ) { 
00265     MPI_Close_port(_portName);
00266     MPI_Finalize();
00267     exit(-1);
00268     }
00269   _tag1 += 2;
00270   _tag2 += 2;
00271   return p._retn();
00272 }
00273 
00274 void SALOME_MPISender_i::send()
00275 {
00276   _type=getTypeOfDataTransmitted();
00277   _argsForThr=new void *[8];
00278   _argsForThr[0]=_portName;
00279   _argsForThr[1]=&_lgrTabToSend;
00280   _argsForThr[2]=(void *)_tabToSend;
00281   _argsForThr[3]=&_cproc;
00282   _argsForThr[4]=&_tag1Inst;
00283   _argsForThr[5]=&_tag2Inst;
00284   _argsForThr[6]=&_com;
00285   _argsForThr[7]=&_type;
00286 
00287   _newThr=new omni_thread(SALOME_MPISender_i::myThread,_argsForThr);
00288   _newThr->start();
00289 }
00290 
00291 void* SALOME_MPISender_i::myThread(void *args)
00292 {
00293   void **argsTab=(void **)args;
00294   long *lgrTabToSend=(long *)argsTab[1];
00295   int *cproc=(int *)argsTab[3];
00296   int *tag1=(int *)argsTab[4];
00297   int *tag2=(int *)argsTab[5];
00298   MPI_Comm *com=(MPI_Comm *)argsTab[6];
00299   SALOME::TypeOfDataTransmitted *type=(SALOME::TypeOfDataTransmitted *)argsTab[7];
00300 
00301   MPI_Comm_accept((char *)argsTab[0],MPI_INFO_NULL,0,MPI_COMM_SELF,com);
00302   MPI_Send(lgrTabToSend,1,MPI_LONG,*cproc,*tag1,*com);
00303   switch(*type)
00304     { 
00305     case SALOME::DOUBLE_:
00306       MPI_Send(argsTab[2],*lgrTabToSend,MPI_DOUBLE,*cproc,*tag2,*com);
00307       break;
00308     case SALOME::INT_:
00309       MPI_Send(argsTab[2],*lgrTabToSend,MPI_INT,*cproc,*tag2,*com);
00310     }
00311   omni_thread::exit();
00312   return args;
00313 }
00314 
00315 void SALOME_MPISender_i::close(const SALOME::MPISender::param& p)
00316 {
00317   std::string service(p.service);
00318   void *r;
00319   _newThr->join(&r);
00320   MPI_Comm_free(&_com); 
00321   MPI_Unpublish_name((char *)service.c_str(),MPI_INFO_NULL,_portName); 
00322   MPI_Close_port(_portName);
00323   delete [] _argsForThr;
00324 }
00325 
00326 SALOME_MPISenderDouble_i::SALOME_MPISenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend)
00327   :SALOME_SenderDouble_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_MPISender_i(tabToSend,lgrTabToSend,sizeof(double),ownTabToSend)
00328   ,SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(double),ownTabToSend)
00329 {
00330 }
00331 
00332 SALOME_MPISenderInt_i::SALOME_MPISenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend)
00333   :SALOME_SenderInt_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_MPISender_i(tabToSend,lgrTabToSend,sizeof(int),ownTabToSend)
00334   ,SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(int),ownTabToSend)
00335 {
00336 }
00337 
00338 #endif
00339 
00340 #ifdef HAVE_SOCKET
00341 
00342 //CCRT porting
00343 #define _POSIX_PII_SOCKET
00344 #define _LIBC_POLLUTION_H_
00345 
00346 #include <sys/types.h>
00347 #include <sys/socket.h>
00348 #include <netinet/in.h>
00349 #include <arpa/inet.h>
00350 #include <netdb.h>
00351 #include <unistd.h>
00352 
00353 SALOME_SocketSender_i::SALOME_SocketSender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend):SALOME_Sender_i(tabToSend,lgrTabToSend,sizeOf,ownTabToSend){
00354   _IPAddress = inetAddress();
00355   _serverSockfd = -1;
00356   _clientSockfd = -1;
00357 }
00358 
00359 SALOME_SocketSender_i::~SALOME_SocketSender_i(){
00360 }
00361 
00362 std::string SALOME_SocketSender_i::inetAddress()
00363 {
00364    char s[256];
00365    char t[INET_ADDRSTRLEN+1];
00366    struct hostent *host;
00367    struct in_addr saddr;
00368 
00369    gethostname(s, 255);
00370 
00371    *t = '\0';
00372 
00373    saddr.s_addr = inet_addr(s);
00374    if (saddr.s_addr != -1)
00375       inet_ntop(AF_INET, &saddr, t, INET_ADDRSTRLEN);
00376    else {
00377       host = gethostbyname(s);
00378       if (host != NULL)
00379          inet_ntop(AF_INET, (struct in_addr *) *host->h_addr_list, 
00380                    t, INET_ADDRSTRLEN);
00381    }
00382    return std::string(t);
00383 }
00384 
00385 SALOME::SocketSender::param * SALOME_SocketSender_i::getParam()
00386 {
00387 
00388   SALOME::SocketSender::param_var p = new SALOME::SocketSender::param;
00389 
00390   p->lstart = 0;
00391   p->lend = _lgrTabToSend - 1;
00392   p->myport = _port;
00393   p->internet_address = CORBA::string_dup(_IPAddress.c_str());
00394 
00395   return p._retn();
00396 }
00397 
00398 void SALOME_SocketSender_i::send()
00399 {
00400   _type=getTypeOfDataTransmitted();
00401   _argsForThr=new void *[6];
00402   _argsForThr[0]=&_serverSockfd;
00403   _argsForThr[1]=&_clientSockfd;
00404   _argsForThr[2]=&_lgrTabToSend;
00405   _argsForThr[3]=(void *)_tabToSend;
00406   _argsForThr[4]=&_errorFlag;
00407   _argsForThr[5]=&_type;
00408 
00409   _newThr=new omni_thread(SALOME_SocketSender_i::myThread,_argsForThr);
00410   _newThr->start();
00411 }
00412 
00413 void* SALOME_SocketSender_i::myThread(void *args)
00414 {
00415   int n=0, m;
00416   void **argsTab=(void **)args;
00417   int *serverSockfd=(int *)argsTab[0];
00418   int *clientSockfd=(int *)argsTab[1];
00419   long *lgrTabToSend=(long *)argsTab[2];
00420   void *tabToSend=argsTab[3];
00421   bool *errorFlag=(bool*)argsTab[4];
00422   SALOME::TypeOfDataTransmitted *type=(SALOME::TypeOfDataTransmitted *)argsTab[5];
00423   
00424   XDR xp; /* pointeur sur le decodeur XDR */
00425   
00426   switch(*type)
00427     { 
00428     case SALOME::DOUBLE_:
00429       xdrmem_create(&xp,(char*)tabToSend,(*lgrTabToSend)*sizeof(double),XDR_ENCODE );
00430       xdr_vector( &xp, (char*)tabToSend, *lgrTabToSend, sizeof(double), (xdrproc_t)xdr_double );
00431 
00432       *errorFlag = false;
00433       while( n < *lgrTabToSend*sizeof(double) ){
00434         m = write(*clientSockfd, (char*)tabToSend+n, *lgrTabToSend*sizeof(double)-n);
00435         if( m < 0 ){
00436           if( *clientSockfd >= 0 ){
00437             ::close(*clientSockfd);
00438             *clientSockfd = -1;
00439           }
00440           if( *serverSockfd >= 0 ){
00441             ::close(*serverSockfd);
00442             *serverSockfd = -1;
00443           }
00444           *errorFlag = true;
00445         }
00446         n += m;
00447       }
00448       xdr_destroy( &xp );
00449 
00450       xdrmem_create(&xp,(char*)tabToSend,(*lgrTabToSend)*sizeof(double),XDR_DECODE );
00451       xdr_vector( &xp, (char*)tabToSend, *lgrTabToSend, sizeof(double), (xdrproc_t)xdr_double );
00452       xdr_destroy( &xp );
00453       break;
00454     case SALOME::INT_:
00455       xdrmem_create(&xp,(char*)tabToSend,(*lgrTabToSend)*sizeof(int),XDR_ENCODE );
00456       xdr_vector( &xp, (char*)tabToSend, *lgrTabToSend, sizeof(int), (xdrproc_t)xdr_int );
00457 
00458       *errorFlag = false;
00459       while( n < *lgrTabToSend*sizeof(int) ){
00460         m = write(*clientSockfd, (char*)tabToSend+n, *lgrTabToSend*sizeof(int)-n);
00461         if( m < 0 ){
00462           if( *clientSockfd >= 0 ){
00463             ::close(*clientSockfd);
00464             *clientSockfd = -1;
00465           }
00466           if( *serverSockfd >= 0 ){
00467             ::close(*serverSockfd);
00468             *serverSockfd = -1;
00469           }
00470           *errorFlag = true;
00471         }
00472         n += m;
00473       }
00474       xdr_destroy( &xp );
00475 
00476       xdrmem_create(&xp,(char*)tabToSend,(*lgrTabToSend)*sizeof(int),XDR_DECODE );
00477       xdr_vector( &xp, (char*)tabToSend, *lgrTabToSend, sizeof(int), (xdrproc_t)xdr_int );
00478       xdr_destroy( &xp );
00479     }
00480   return args;
00481 }
00482 
00483 void SALOME_SocketSender_i::initCom() throw(SALOME::SALOME_Exception)
00484 {
00485   struct sockaddr_in serv_addr;
00486   socklen_t n;
00487   SALOME::ExceptionStruct es;
00488 
00489   /* Ouverture de la socket */
00490   _serverSockfd = socket(AF_INET , SOCK_STREAM , 0);
00491   if(_serverSockfd < 0) {
00492     es.type = SALOME::COMM;
00493     es.text = "error Socket exception";
00494     throw SALOME::SALOME_Exception(es);
00495   }
00496   /* Socket structure initialisation*/
00497   bzero((char*)&serv_addr,sizeof(serv_addr));
00498   serv_addr.sin_family = AF_INET;
00499   serv_addr.sin_port = 0; /* asking for a free port */
00500   serv_addr.sin_addr.s_addr = INADDR_ANY;
00501 
00502   /* Association of socket with a port */
00503   if( ::bind(_serverSockfd, (struct sockaddr *) & serv_addr, 
00504            sizeof(struct sockaddr)) < 0 ) {
00505     closeCom();
00506     es.type = SALOME::COMM;
00507     es.text = "error bind Socket exception";
00508     throw SALOME::SALOME_Exception(es);
00509   }
00510   /* Listening to the allocated port */
00511   if( listen(_serverSockfd, 10) < 0 ) {
00512     closeCom();
00513     es.type = SALOME::COMM;
00514     es.text = "error listen Socket exception";
00515     throw SALOME::SALOME_Exception(es);
00516   }
00517   /* Retrieving port number*/
00518   if( getsockname(_serverSockfd, (struct sockaddr *) & serv_addr, &n) < 0 ){
00519     closeCom();
00520     es.type = SALOME::COMM;
00521     es.text = "error getName Socket exception";
00522     throw SALOME::SALOME_Exception(es);
00523   }
00524   _port = htons(serv_addr.sin_port);
00525   SCRUTE(_port);
00526 }
00527 
00528 void SALOME_SocketSender_i::acceptCom() throw(SALOME::SALOME_Exception)
00529 {
00530   socklen_t sin_size;
00531   struct sockaddr_in client_addr;
00532   SALOME::ExceptionStruct es;
00533 
00534   sin_size = sizeof(struct sockaddr_in);
00535   
00536   _clientSockfd = accept(_serverSockfd, (struct sockaddr *)&client_addr, &sin_size);
00537   if( _clientSockfd < 0 ){
00538     closeCom();
00539     es.type = SALOME::COMM;
00540     es.text = "error accept Socket exception";
00541     throw SALOME::SALOME_Exception(es);
00542   }
00543 }
00544 
00545 void SALOME_SocketSender_i::closeCom()
00546 {
00547   if( _clientSockfd >= 0 ){
00548     ::close(_clientSockfd);
00549     _clientSockfd = -1;
00550   }
00551   if( _serverSockfd >= 0 ){
00552     ::close(_serverSockfd);
00553     _serverSockfd = -1;
00554   }
00555 
00556 }
00557 
00558 void SALOME_SocketSender_i::endOfCom()
00559 {
00560   void *r;
00561   _newThr->join(&r);
00562   if(_errorFlag)
00563     {
00564       SALOME::ExceptionStruct es;
00565       es.type = SALOME::COMM;
00566       es.text = "error write Socket exception";
00567       throw SALOME::SALOME_Exception(es);
00568     }
00569   delete [] _argsForThr;
00570 }
00571 
00572 SALOME_SocketSenderDouble_i::SALOME_SocketSenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend)
00573   :SALOME_SenderDouble_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_SocketSender_i(tabToSend,lgrTabToSend,sizeof(double),ownTabToSend)
00574   ,SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(double),ownTabToSend)
00575 {
00576 }
00577 
00578 SALOME_SocketSenderInt_i::SALOME_SocketSenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend)
00579   :SALOME_SenderInt_i(tabToSend,lgrTabToSend,ownTabToSend),SALOME_SocketSender_i(tabToSend,lgrTabToSend,sizeof(int),ownTabToSend)
00580   ,SALOME_Sender_i(tabToSend,lgrTabToSend,sizeof(int),ownTabToSend)
00581 {
00582 }
00583 
00584 //CCRT porting
00585 #undef _LIBC_POLLUTION_H_
00586 #undef _POSIX_PII_SOCKET
00587 
00588 #endif