(file) Return to Socket.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/Socket.cpp between version 1.7 and 1.9.4.8

version 1.7, 2003/04/15 12:05:48 version 1.9.4.8, 2003/08/13 21:12:03
Line 31 
Line 31 
  
 #ifdef PEGASUS_OS_TYPE_WINDOWS #ifdef PEGASUS_OS_TYPE_WINDOWS
 # include <windows.h> # include <windows.h>
   # ifndef _WINSOCKAPI_
   #   include <winsock2.h>
   # endif
 #else #else
 # include <cctype> # include <cctype>
 #ifndef PEGASUS_OS_OS400 #ifndef PEGASUS_OS_OS400
 #   include <unistd.h> #   include <unistd.h>
 #else #else
 #   include <Pegasus/Common/OS400ConvertChar.h>  
 #   include <unistd.cleinc> #   include <unistd.cleinc>
 #endif #endif
 #ifdef PEGASUS_OS_ZOS  
 #   include <string.h>  // added by rk for memcpy #   include <string.h>  // added by rk for memcpy
 #endif  
 # include <cstdlib> # include <cstdlib>
 # include <errno.h> # include <errno.h>
 # include <fcntl.h> # include <fcntl.h>
Line 49 
Line 49 
 # include <netinet/in.h> # include <netinet/in.h>
 # include <arpa/inet.h> # include <arpa/inet.h>
 # include <sys/socket.h> # include <sys/socket.h>
   # include <errno.h>
 #endif #endif
  
   #include <Pegasus/Common/Sharable.h>
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 static Uint32 _socketInterfaceRefCount = 0; static Uint32 _socketInterfaceRefCount = 0;
Line 63 
Line 65 
     int i=::read(socket, (char*)ptr, size);     int i=::read(socket, (char*)ptr, size);
     __atoe_l((char *)ptr,size);     __atoe_l((char *)ptr,size);
     return i;     return i;
 #elif defined(PEGASUS_OS_OS400)  #else
     int i=::read(socket, (char*)ptr, size);  
     AtoE((char *)ptr, size);  #if defined (__GNUC__)
     return i;      int ccode = TEMP_FAILURE_RETRY(::read(socket, (char*)ptr, size));
       return ccode;
 #else #else
     return ::read(socket, (char*)ptr, size);     return ::read(socket, (char*)ptr, size);
 #endif #endif
   #endif
 } }
  
 Sint32 Socket::write(Sint32 socket, const void* ptr, Uint32 size) Sint32 Socket::write(Sint32 socket, const void* ptr, Uint32 size)
Line 84 
Line 88 
     i = ::write(socket, ptr2, size);     i = ::write(socket, ptr2, size);
     free(ptr2);     free(ptr2);
     return i;     return i;
 #elif defined(PEGASUS_OS_OS400)  #else
     char * ptr2 = (char *)malloc(size);  #if (__GNUC__)
     int i;      int ccode = TEMP_FAILURE_RETRY(::write(socket, (char*)ptr, size));
     memcpy(ptr2,ptr,size);      return ccode;
     EtoA(ptr2,size);  
     i = ::write(socket, ptr2, size);  
     free(ptr2);  
     return i;  
 #else #else
     return ::write(socket, (char*)ptr, size);     return ::write(socket, (char*)ptr, size);
 #endif #endif
   #endif
 } }
  
 void Socket::close(Sint32 socket) void Socket::close(Sint32 socket)
Line 102 
Line 103 
 #ifdef PEGASUS_OS_TYPE_WINDOWS #ifdef PEGASUS_OS_TYPE_WINDOWS
     closesocket(socket);     closesocket(socket);
 #else #else
   #if (__GNUC__)
       TEMP_FAILURE_RETRY(::close(socket));
   #else
     ::close(socket);     ::close(socket);
 #endif #endif
   #endif
 } }
  
   int Socket::close2(Sint32 socket)
   {
   #ifdef PEGASUS_OS_TYPE_WINDOWS
       return closesocket(socket);
   #else
   #if (__GNUC__)
       int ccode = TEMP_FAILURE_RETRY(::close(socket));
       return ccode;
   #else
       return ::close(socket);
   #endif
   #endif
   }
   
   
 void Socket::enableBlocking(Sint32 socket) void Socket::enableBlocking(Sint32 socket)
 { {
 #ifdef PEGASUS_OS_TYPE_WINDOWS #ifdef PEGASUS_OS_TYPE_WINDOWS
Line 118 
Line 138 
 #endif #endif
 } }
  
   int Socket::enableBlocking2(Sint32 socket)
   {
   #ifdef PEGASUS_OS_TYPE_WINDOWS
       unsigned long flag = 0;
       return ioctlsocket(socket, FIONBIO, &flag);
   #else
       int flags = fcntl(socket, F_GETFL, 0);
       flags &= ~O_NONBLOCK;
       return fcntl(socket, F_SETFL, flags);
   #endif
   }
   
 void Socket::disableBlocking(Sint32 socket) void Socket::disableBlocking(Sint32 socket)
 { {
 #ifdef PEGASUS_OS_TYPE_WINDOWS #ifdef PEGASUS_OS_TYPE_WINDOWS
Line 130 
Line 162 
 #endif #endif
 } }
  
   int Socket::disableBlocking2(Sint32 socket)
   {
   #ifdef PEGASUS_OS_TYPE_WINDOWS
       unsigned long flag = 1;
       return ioctlsocket(socket, FIONBIO, &flag);
   #else
       int flags = fcntl(socket, F_GETFL, 0);
       flags |= O_NONBLOCK;
       return fcntl(socket, F_SETFL, flags);
   #endif
   }
   
 void Socket::initializeInterface() void Socket::initializeInterface()
 { {
 #ifdef PEGASUS_OS_TYPE_WINDOWS #ifdef PEGASUS_OS_TYPE_WINDOWS
Line 155 
Line 199 
 #endif #endif
 } }
  
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
   


Legend:
Removed from v.1.7  
changed lines
  Added in v.1.9.4.8

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2