activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r419365 [17/25] - in /incubator/activemq/trunk: activemq-core/src/main/java/org/apache/activemq/thread/ activemq-core/src/test/java/org/apache/activemq/openwire/v1/ activemq-cpp/src/main/activemq/concurrent/ activemq-cpp/src/main/activemq/c...
Date Wed, 05 Jul 2006 22:27:47 GMT
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketInputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketInputStream.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketInputStream.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketInputStream.cpp Wed Jul  5 15:27:34 2006
@@ -1,175 +1,175 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- 
-#if (defined(unix) || defined(__APPLE__)) && !defined(__CYGWIN__)
-   #include <sys/poll.h>
-   #include <sys/socket.h>
-   #include <errno.h>
-   extern int errno;
-#else
-   #include <Winsock2.h>
-#endif
-
-#include <activemq/network/SocketInputStream.h>
-#include <activemq/io/IOException.h>
-#include <stdlib.h>
-#include <string>
-
-using namespace activemq;
-using namespace activemq::network;
-using namespace activemq::io;
-using namespace std;
-
-////////////////////////////////////////////////////////////////////////////////
-SocketInputStream::SocketInputStream( network::Socket::SocketHandle socket )
-{
-    this->socket = socket;
-    debug = false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-SocketInputStream::~SocketInputStream()
-{
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int SocketInputStream::available() const{
-   
-   
-#if (defined(unix) || defined(__APPLE__)) && !defined(__CYGWIN__)
-    
-    // Poll the socket for input.
-    pollfd fd;
-    fd.fd = socket;
-    fd.events = POLLIN;
-    fd.revents = POLLIN;
-    int status = poll( &fd, 1, 1 );
-    if( status > 0 ){
-        return 1;
-    }
-   
-#else 
-
-    // Poll instantaneously to see if there is data on the socket.
-    timeval timeout;
-    timeout.tv_sec = 0;
-    timeout.tv_usec = 100;
-   
-    fd_set pollSet;
-    FD_ZERO( &pollSet );
-    FD_SET( 0, &pollSet );
-    pollSet.fd_array[0] = socket;
-    if( ::select( 1, &pollSet, NULL, NULL, &timeout) > 0 ){
-        return 1;
-    }
-   
-#endif
-
-    return 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-unsigned char SocketInputStream::read() throw (IOException){
-   
-    unsigned char c;  
-    int len = read( &c, 1 );
-    if( len != sizeof(c) ){
-        throw IOException( __FILE__, __LINE__, 
-            "activemq::io::SocketInputStream::read - failed reading a byte");
-    }
-   
-    return c;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int SocketInputStream::read( unsigned char* buffer, const int bufferSize ) throw (IOException){
-   
-    int bytesAvailable = available();
-   
-    while( true )
-    {
-        int len = ::recv(socket, (char*)buffer, bufferSize, 0);
-      
-        // Check for typical error conditions.
-        if( len < 0 )
-        {
-            #if defined(unix) && !defined(__CYGWIN__)
-         
-                // If the socket was temporarily unavailable - just try again.
-                if( errno == EAGAIN ){
-                    continue;
-                }
-             
-                // Create the error string.
-                char* errorString = ::strerror(errno);
-             
-            #else
-            
-                // If the socket was temporarily unavailable - just try again.
-                int errorCode = ::WSAGetLastError();
-                if( errorCode == WSAEWOULDBLOCK ){
-                    continue;
-                }
-          
-                // Create the error string.
-                static const int errorStringSize = 512;
-                char errorString[errorStringSize];
-                memset( errorString, 0, errorStringSize );
-                FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
-                   0,
-                   errorCode,
-                   0,
-                   errorString,
-                   errorStringSize - 1,
-                   NULL);
-                  
-            #endif
-            
-            // Otherwise, this was a bad error - throw an exception.
-            throw IOException( __FILE__, __LINE__, 
-                "activemq::io::SocketInputStream::read - %s", errorString );
-        }
-      
-        // No error, but no data - check for a broken socket.
-        if( len == 0 )
-        {
-            // If the poll showed data, but we failed to read any,
-            // the socket is broken.
-            if( bytesAvailable > 0 ){
-                throw IOException( __FILE__, __LINE__, 
-                    "activemq::io::SocketInputStream::read - The connection is broken" );
-            }
-         
-            // Socket is not broken, just had no data.
-            return 0;
-        }
-      
-        if( debug ){
-            printf("SocketInputStream:read(), numbytes:%d -", len);
-            for( int ix=0; ix<len; ++ix ){
-                if( buffer[ix] > 20 )
-                    printf("%c", buffer[ix] );
-                else
-                    printf("[%d]", buffer[ix] );
-            }
-            printf("\n");
-        }
-        
-        // Data was read successfully - return the bytes read.
-        return len;
-    }
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#if (defined(unix) || defined(__APPLE__)) && !defined(__CYGWIN__)
+   #include <sys/poll.h>
+   #include <sys/socket.h>
+   #include <errno.h>
+   extern int errno;
+#else
+   #include <Winsock2.h>
+#endif
+
+#include <activemq/network/SocketInputStream.h>
+#include <activemq/io/IOException.h>
+#include <stdlib.h>
+#include <string>
+
+using namespace activemq;
+using namespace activemq::network;
+using namespace activemq::io;
+using namespace std;
+
+////////////////////////////////////////////////////////////////////////////////
+SocketInputStream::SocketInputStream( network::Socket::SocketHandle socket )
+{
+    this->socket = socket;
+    debug = false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+SocketInputStream::~SocketInputStream()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int SocketInputStream::available() const{
+   
+   
+#if (defined(unix) || defined(__APPLE__)) && !defined(__CYGWIN__)
+    
+    // Poll the socket for input.
+    pollfd fd;
+    fd.fd = socket;
+    fd.events = POLLIN;
+    fd.revents = POLLIN;
+    int status = poll( &fd, 1, 1 );
+    if( status > 0 ){
+        return 1;
+    }
+   
+#else 
+
+    // Poll instantaneously to see if there is data on the socket.
+    timeval timeout;
+    timeout.tv_sec = 0;
+    timeout.tv_usec = 100;
+   
+    fd_set pollSet;
+    FD_ZERO( &pollSet );
+    FD_SET( 0, &pollSet );
+    pollSet.fd_array[0] = socket;
+    if( ::select( 1, &pollSet, NULL, NULL, &timeout) > 0 ){
+        return 1;
+    }
+   
+#endif
+
+    return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned char SocketInputStream::read() throw (IOException){
+   
+    unsigned char c;  
+    int len = read( &c, 1 );
+    if( len != sizeof(c) ){
+        throw IOException( __FILE__, __LINE__, 
+            "activemq::io::SocketInputStream::read - failed reading a byte");
+    }
+   
+    return c;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int SocketInputStream::read( unsigned char* buffer, const int bufferSize ) throw (IOException){
+   
+    int bytesAvailable = available();
+   
+    while( true )
+    {
+        int len = ::recv(socket, (char*)buffer, bufferSize, 0);
+      
+        // Check for typical error conditions.
+        if( len < 0 )
+        {
+            #if defined(unix) && !defined(__CYGWIN__)
+         
+                // If the socket was temporarily unavailable - just try again.
+                if( errno == EAGAIN ){
+                    continue;
+                }
+             
+                // Create the error string.
+                char* errorString = ::strerror(errno);
+             
+            #else
+            
+                // If the socket was temporarily unavailable - just try again.
+                int errorCode = ::WSAGetLastError();
+                if( errorCode == WSAEWOULDBLOCK ){
+                    continue;
+                }
+          
+                // Create the error string.
+                static const int errorStringSize = 512;
+                char errorString[errorStringSize];
+                memset( errorString, 0, errorStringSize );
+                FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
+                   0,
+                   errorCode,
+                   0,
+                   errorString,
+                   errorStringSize - 1,
+                   NULL);
+                  
+            #endif
+            
+            // Otherwise, this was a bad error - throw an exception.
+            throw IOException( __FILE__, __LINE__, 
+                "activemq::io::SocketInputStream::read - %s", errorString );
+        }
+      
+        // No error, but no data - check for a broken socket.
+        if( len == 0 )
+        {
+            // If the poll showed data, but we failed to read any,
+            // the socket is broken.
+            if( bytesAvailable > 0 ){
+                throw IOException( __FILE__, __LINE__, 
+                    "activemq::io::SocketInputStream::read - The connection is broken" );
+            }
+         
+            // Socket is not broken, just had no data.
+            return 0;
+        }
+      
+        if( debug ){
+            printf("SocketInputStream:read(), numbytes:%d -", len);
+            for( int ix=0; ix<len; ++ix ){
+                if( buffer[ix] > 20 )
+                    printf("%c", buffer[ix] );
+                else
+                    printf("[%d]", buffer[ix] );
+            }
+            printf("\n");
+        }
+        
+        // Data was read successfully - return the bytes read.
+        return len;
+    }
+}

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketInputStream.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketInputStream.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketOutputStream.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketOutputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketOutputStream.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketOutputStream.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketOutputStream.h Wed Jul  5 15:27:34 2006
@@ -1,142 +1,142 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ACTIVEMQ_NETWORK_SOCKETOUTPUTSTREAM_H_
-#define ACTIVEMQ_NETWORK_SOCKETOUTPUTSTREAM_H_
- 
-#include <activemq/io/OutputStream.h>
-#include <activemq/network/Socket.h>
-#include <activemq/concurrent/Mutex.h>
-
-namespace activemq{
-namespace network{
-      
-   /**
-    * Output stream for performing write operations
-    * on a socket.
-    */
-   class SocketOutputStream : public io::OutputStream
-   {
-   private:
-   
-      // The socket.
-      Socket::SocketHandle socket;
-      concurrent::Mutex mutex;
-      bool debug;
-      
-   public:
-   
-      /**
-       * Constructor.
-       * @param socket the socket handle.
-       */
-      SocketOutputStream( Socket::SocketHandle socket );
-      
-      /**
-       * Destructor.
-       */
-      virtual ~SocketOutputStream();
-      
-      virtual void setDebug( const bool debug ){
-        this->debug = debug;
-      }
-      
-      /**
-       * Locks the object.
-       */
-      virtual void lock() throw(exceptions::ActiveMQException){
-         mutex.lock();
-      }
-   
-      /**
-       * Unlocks the object.
-       */
-      virtual void unlock() throw(exceptions::ActiveMQException){   
-         mutex.unlock();
-      }
-       
-      /**
-       * Waits on a signal from this object, which is generated
-       * by a call to Notify.  Must have this object locked before
-       * calling.
-       */
-      virtual void wait() throw(exceptions::ActiveMQException){
-         mutex.wait();
-      }
-    
-      /**
-       * Waits on a signal from this object, which is generated
-       * by a call to Notify.  Must have this object locked before
-       * calling.  This wait will timeout after the specified time
-       * interval.
-       * @param time in millisecsonds to wait, or WAIT_INIFINITE
-       * @throws ActiveMQException
-       */
-      virtual void wait(unsigned long millisecs) 
-         throw(exceptions::ActiveMQException) {
-         
-         mutex.wait(millisecs);
-      }
-
-      /**
-       * Signals a waiter on this object that it can now wake
-       * up and continue.  Must have this object locked before
-       * calling.
-       */
-      virtual void notify() throw(exceptions::ActiveMQException){
-         mutex.notify();
-      }
-        
-      /**
-       * Signals the waiters on this object that it can now wake
-       * up and continue.  Must have this object locked before
-       * calling.
-       */
-      virtual void notifyAll() throw(exceptions::ActiveMQException){
-         mutex.notifyAll();
-      }
-       
-       /**
-       * Writes a single byte to the output stream.
-       * @param c the byte.
-       * @throws IOException thrown if an error occurs.
-       */
-      virtual void write( const unsigned char c ) throw (io::IOException);
-      
-      /**
-       * Writes an array of bytes to the output stream.
-       * @param buffer The array of bytes to write.
-       * @param len The number of bytes from the buffer to be written.
-       * @throws IOException thrown if an error occurs.
-       */
-      virtual void write( const unsigned char* buffer, const int len ) throw (io::IOException);
-      
-      /**
-       * Flush - does nothing.
-       */
-      virtual void flush() throw (io::IOException){};
-      
-      /**
-       * Close - does nothing.  It is the responsibility of the owner
-       * of the socket object to close it.
-       */
-      virtual void close() throw(cms::CMSException){} 
-   };
-   
-}}
-
-#endif /*ACTIVEMQ_NETWORK_SOCKETOUTPUTSTREAM_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ACTIVEMQ_NETWORK_SOCKETOUTPUTSTREAM_H_
+#define ACTIVEMQ_NETWORK_SOCKETOUTPUTSTREAM_H_
+ 
+#include <activemq/io/OutputStream.h>
+#include <activemq/network/Socket.h>
+#include <activemq/concurrent/Mutex.h>
+
+namespace activemq{
+namespace network{
+      
+   /**
+    * Output stream for performing write operations
+    * on a socket.
+    */
+   class SocketOutputStream : public io::OutputStream
+   {
+   private:
+   
+      // The socket.
+      Socket::SocketHandle socket;
+      concurrent::Mutex mutex;
+      bool debug;
+      
+   public:
+   
+      /**
+       * Constructor.
+       * @param socket the socket handle.
+       */
+      SocketOutputStream( Socket::SocketHandle socket );
+      
+      /**
+       * Destructor.
+       */
+      virtual ~SocketOutputStream();
+      
+      virtual void setDebug( const bool debug ){
+        this->debug = debug;
+      }
+      
+      /**
+       * Locks the object.
+       */
+      virtual void lock() throw(exceptions::ActiveMQException){
+         mutex.lock();
+      }
+   
+      /**
+       * Unlocks the object.
+       */
+      virtual void unlock() throw(exceptions::ActiveMQException){   
+         mutex.unlock();
+      }
+       
+      /**
+       * Waits on a signal from this object, which is generated
+       * by a call to Notify.  Must have this object locked before
+       * calling.
+       */
+      virtual void wait() throw(exceptions::ActiveMQException){
+         mutex.wait();
+      }
+    
+      /**
+       * Waits on a signal from this object, which is generated
+       * by a call to Notify.  Must have this object locked before
+       * calling.  This wait will timeout after the specified time
+       * interval.
+       * @param time in millisecsonds to wait, or WAIT_INIFINITE
+       * @throws ActiveMQException
+       */
+      virtual void wait(unsigned long millisecs) 
+         throw(exceptions::ActiveMQException) {
+         
+         mutex.wait(millisecs);
+      }
+
+      /**
+       * Signals a waiter on this object that it can now wake
+       * up and continue.  Must have this object locked before
+       * calling.
+       */
+      virtual void notify() throw(exceptions::ActiveMQException){
+         mutex.notify();
+      }
+        
+      /**
+       * Signals the waiters on this object that it can now wake
+       * up and continue.  Must have this object locked before
+       * calling.
+       */
+      virtual void notifyAll() throw(exceptions::ActiveMQException){
+         mutex.notifyAll();
+      }
+       
+       /**
+       * Writes a single byte to the output stream.
+       * @param c the byte.
+       * @throws IOException thrown if an error occurs.
+       */
+      virtual void write( const unsigned char c ) throw (io::IOException);
+      
+      /**
+       * Writes an array of bytes to the output stream.
+       * @param buffer The array of bytes to write.
+       * @param len The number of bytes from the buffer to be written.
+       * @throws IOException thrown if an error occurs.
+       */
+      virtual void write( const unsigned char* buffer, const int len ) throw (io::IOException);
+      
+      /**
+       * Flush - does nothing.
+       */
+      virtual void flush() throw (io::IOException){};
+      
+      /**
+       * Close - does nothing.  It is the responsibility of the owner
+       * of the socket object to close it.
+       */
+      virtual void close() throw(cms::CMSException){} 
+   };
+   
+}}
+
+#endif /*ACTIVEMQ_NETWORK_SOCKETOUTPUTSTREAM_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketOutputStream.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp Wed Jul  5 15:27:34 2006
@@ -1,322 +1,322 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if (defined(unix) || defined(__APPLE__)) && !defined(__CYGWIN__)
-   #include <unistd.h>
-   #include <netdb.h>
-   #include <fcntl.h>
-   #include <sys/file.h>
-   #include <sys/socket.h>
-   #include <netinet/in.h>
-   #include <arpa/inet.h>
-   extern int errno;
-#else
-   #include <Winsock2.h>
-   #include <Ws2tcpip.h> 
-   #include <sys/stat.h>
-   #define stat _stat
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <errno.h>
-#include <sys/types.h>
-#include "TcpSocket.h"
-#include "SocketInputStream.h"
-#include "SocketOutputStream.h"
-#include <errno.h>
-
-using namespace activemq::network;
-using namespace activemq::io;
-
-
-#if !(defined( unix ) || defined(__APPLE__)) || defined( __CYGWIN__ )
-
-   // Static socket initializer needed for winsock
-
-   TcpSocket::StaticSocketInitializer::StaticSocketInitializer () {
-       socketInitError = NULL;
-       const WORD version_needed = MAKEWORD(2,2); // lo-order byte: major version
-       WSAData temp;       
-       if (WSAStartup(version_needed, &temp)){
-         clear();
-           socketInitError = new SocketException ( __FILE__, __LINE__,
-                "winsock.dll was not found");
-       }
-   }
-   TcpSocket::StaticSocketInitializer::~StaticSocketInitializer () {
-      clear();
-      WSACleanup();
-   }
-   
-   // Create static instance of the socket initializer.
-   TcpSocket::StaticSocketInitializer TcpSocket::staticSocketInitializer;
-   
-#endif
-
-////////////////////////////////////////////////////////////////////////////////
-TcpSocket::TcpSocket() {
-   
-   socketHandle = INVALID_SOCKET_HANDLE;
-   inputStream = NULL;
-   outputStream = NULL;
-   
-#if !(defined( unix ) || defined(__APPLE__)) || defined( __CYGWIN__ )
-    if (staticSocketInitializer.getSocketInitError() != NULL) {
-        throw *staticSocketInitializer.getSocketInitError();
-    }
-#endif
-}
-
-////////////////////////////////////////////////////////////////////////////////
-TcpSocket::TcpSocket(Socket::SocketHandle socketHandle){
-   this->socketHandle = socketHandle;
-   
-   inputStream = new SocketInputStream( socketHandle );
-   outputStream = new SocketOutputStream( socketHandle );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-TcpSocket::~TcpSocket()
-{
-   // No shutdown, just close - dont want blocking destructor.
-   close();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-InputStream* TcpSocket::getInputStream(){
-   return inputStream;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-OutputStream* TcpSocket::getOutputStream(){
-   return outputStream;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::connect(const char* host, int port) throw (SocketException)
-{
-   if( isConnected() ) {
-      throw SocketException( __FILE__, __LINE__, 
-         "Socket::connect - Socket already connected.  host: %s, port: %d", host, port );
-   }
-    
-   // Create the socket.
-   socketHandle = ::socket(AF_INET, SOCK_STREAM, 0);
-   if( socketHandle < 0 ) {
-      socketHandle = INVALID_SOCKET_HANDLE;
-         throw SocketException( __FILE__, __LINE__, ::strerror( errno ) );
-   }
-   
-   // Check port value.
-   if (port <= 0 || port > 65535) {
-      close();
-       throw SocketException ( __FILE__, __LINE__, 
-          "Socket::connect- Port out of range: %d", port );
-   }
-    
-   sockaddr_in target_addr;
-   target_addr.sin_family = AF_INET;
-   target_addr.sin_port = htons((short)port);
-   target_addr.sin_addr.s_addr = 0; // To be set later down...
-   memset(&target_addr.sin_zero, 0, sizeof(target_addr.sin_zero));
-
-   // Resolve name
-   addrinfo hints;
-   memset(&hints, 0, sizeof(addrinfo));
-   hints.ai_family = PF_INET;
-   struct addrinfo *res_ptr = NULL;
-    
-   int status = ::getaddrinfo(host, NULL, &hints, &res_ptr);
-   if( status != 0 || res_ptr == NULL){      
-       throw SocketException( __FILE__, __LINE__, 
-          "Socket::connect - %s", ::strerror( errno ) );        
-   }
-    
-   assert(res_ptr->ai_addr->sa_family == AF_INET);
-   // Porting: On both 32bit and 64 bit systems that we compile to soo far, sin_addr 
-   // is a 32 bit value, not an unsigned long.
-   assert(sizeof(((sockaddr_in*)res_ptr->ai_addr)->sin_addr.s_addr) == 4);
-   target_addr.sin_addr.s_addr = ((sockaddr_in*)res_ptr->ai_addr)->sin_addr.s_addr;
-   freeaddrinfo(res_ptr);
-   
-   // Attempt the connection to the server.
-   status = ::connect(socketHandle, 
-                      (const sockaddr *)&target_addr, 
-                      sizeof(target_addr));
-                      
-   if( status < 0 ){
-       close();
-      throw SocketException( __FILE__, __LINE__, 
-         "Socket::connect - %s", ::strerror( errno ) );
-   }
-   
-   // Create an input/output stream for this socket.
-   inputStream = new SocketInputStream( socketHandle );
-   outputStream = new SocketOutputStream( socketHandle );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::close() throw( cms::CMSException )
-{
-   // Destroy the input stream.
-   if( inputStream != NULL ){
-      delete inputStream;
-      inputStream = NULL;
-   }
-   
-   // Destroy the output stream.
-   if( outputStream != NULL ){
-      delete outputStream;
-      outputStream = NULL;
-   }
-   
-   if( isConnected() )
-   {
-      
-      ::shutdown(socketHandle, 2);
-        
-      #if (defined(unix) || defined(__APPLE__)) && !defined(__CYGWIN__)
-         ::close(socketHandle);
-      #else
-         ::closesocket(socketHandle);
-      #endif
-      
-      socketHandle = INVALID_SOCKET_HANDLE;
-   }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int TcpSocket::getSoLinger() const throw(SocketException){
-   
-   linger value;
-   socklen_t length = sizeof(value);
-   ::getsockopt(socketHandle, SOL_SOCKET, SO_LINGER, (char*)&value, &length );
-   
-   return value.l_onoff? value.l_linger : 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////    
-void TcpSocket::setSoLinger( const int dolinger ) throw(SocketException){
-   
-   linger value;
-   value.l_onoff = dolinger != 0;
-   value.l_linger = dolinger;
-   ::setsockopt(socketHandle, SOL_SOCKET, SO_LINGER, (char*)&value, sizeof(value) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool TcpSocket::getKeepAlive() const throw(SocketException){
-   
-   int value;
-   socklen_t length = sizeof(int);
-   ::getsockopt(socketHandle, SOL_SOCKET, SO_KEEPALIVE, (char*)&value, &length );
-   return value != 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setKeepAlive( const bool keepAlive ) throw(SocketException){
-   
-   int value = keepAlive? 1 : 0;
-   ::setsockopt(socketHandle, SOL_SOCKET, SO_KEEPALIVE, (char*)&value, sizeof(int) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int TcpSocket::getReceiveBufferSize() const throw(SocketException){
-   
-   int value;
-   socklen_t length = sizeof(int);
-   ::getsockopt(socketHandle, SOL_SOCKET, SO_RCVBUF, (char*)&value, &length );
-   return value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setReceiveBufferSize( const int size ) throw(SocketException){
-   
-   ::setsockopt(socketHandle, SOL_SOCKET, SO_RCVBUF, (char*)&size, sizeof(int) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool TcpSocket::getReuseAddress() const throw(SocketException){
-   
-   int value;
-   socklen_t length = sizeof(int);
-   ::getsockopt(socketHandle, SOL_SOCKET, SO_REUSEADDR, (char*)&value, &length );
-   return value != 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setReuseAddress( const bool reuse ) throw(SocketException){
-   
-   int value = reuse? 1 : 0;
-   ::setsockopt(socketHandle, SOL_SOCKET, SO_REUSEADDR, (char*)&value, sizeof(int) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int TcpSocket::getSendBufferSize() const throw(SocketException){
-   
-   int value;
-   socklen_t length = sizeof(int);
-   ::getsockopt(socketHandle, SOL_SOCKET, SO_SNDBUF, (char*)&value, &length );
-   return value;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setSendBufferSize( const int size ) throw(SocketException){
-   
-   ::setsockopt(socketHandle, SOL_SOCKET, SO_SNDBUF, (char*)&size, sizeof(int) );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setSoTimeout ( const int millisecs ) throw (SocketException)
-{
-#if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
-  timeval timot;
-  timot.tv_sec = millisecs / 1000;
-  timot.tv_usec = (millisecs % 1000) * 1000;
-#else
-  int timot = millisecs;
-#endif
-
-  ::setsockopt(socketHandle, SOL_SOCKET, SO_RCVTIMEO, (const char*) &timot, sizeof (timot));
-  ::setsockopt(socketHandle, SOL_SOCKET, SO_SNDTIMEO, (const char*) &timot, sizeof (timot));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-int TcpSocket::getSoTimeout() const throw(SocketException)
-{
-#if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
-  timeval timot;
-  timot.tv_sec = 0;
-  timot.tv_usec = 0;
-  socklen_t size = sizeof(timot);
-#else
-  int timot = 0;
-  int size = sizeof(timot);
-#endif
-  
-  ::getsockopt(socketHandle, SOL_SOCKET, SO_RCVTIMEO, (char*) &timot, &size);
-  
-#if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
-  return (timot.tv_sec * 1000) + (timot.tv_usec / 1000);
-#else
-  return timot;
-#endif
-}
-
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if (defined(unix) || defined(__APPLE__)) && !defined(__CYGWIN__)
+   #include <unistd.h>
+   #include <netdb.h>
+   #include <fcntl.h>
+   #include <sys/file.h>
+   #include <sys/socket.h>
+   #include <netinet/in.h>
+   #include <arpa/inet.h>
+   extern int errno;
+#else
+   #include <Winsock2.h>
+   #include <Ws2tcpip.h> 
+   #include <sys/stat.h>
+   #define stat _stat
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <errno.h>
+#include <sys/types.h>
+#include "TcpSocket.h"
+#include "SocketInputStream.h"
+#include "SocketOutputStream.h"
+#include <errno.h>
+
+using namespace activemq::network;
+using namespace activemq::io;
+
+
+#if !(defined( unix ) || defined(__APPLE__)) || defined( __CYGWIN__ )
+
+   // Static socket initializer needed for winsock
+
+   TcpSocket::StaticSocketInitializer::StaticSocketInitializer () {
+       socketInitError = NULL;
+       const WORD version_needed = MAKEWORD(2,2); // lo-order byte: major version
+       WSAData temp;       
+       if (WSAStartup(version_needed, &temp)){
+         clear();
+           socketInitError = new SocketException ( __FILE__, __LINE__,
+                "winsock.dll was not found");
+       }
+   }
+   TcpSocket::StaticSocketInitializer::~StaticSocketInitializer () {
+      clear();
+      WSACleanup();
+   }
+   
+   // Create static instance of the socket initializer.
+   TcpSocket::StaticSocketInitializer TcpSocket::staticSocketInitializer;
+   
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+TcpSocket::TcpSocket() {
+   
+   socketHandle = INVALID_SOCKET_HANDLE;
+   inputStream = NULL;
+   outputStream = NULL;
+   
+#if !(defined( unix ) || defined(__APPLE__)) || defined( __CYGWIN__ )
+    if (staticSocketInitializer.getSocketInitError() != NULL) {
+        throw *staticSocketInitializer.getSocketInitError();
+    }
+#endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
+TcpSocket::TcpSocket(Socket::SocketHandle socketHandle){
+   this->socketHandle = socketHandle;
+   
+   inputStream = new SocketInputStream( socketHandle );
+   outputStream = new SocketOutputStream( socketHandle );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+TcpSocket::~TcpSocket()
+{
+   // No shutdown, just close - dont want blocking destructor.
+   close();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+InputStream* TcpSocket::getInputStream(){
+   return inputStream;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+OutputStream* TcpSocket::getOutputStream(){
+   return outputStream;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TcpSocket::connect(const char* host, int port) throw (SocketException)
+{
+   if( isConnected() ) {
+      throw SocketException( __FILE__, __LINE__, 
+         "Socket::connect - Socket already connected.  host: %s, port: %d", host, port );
+   }
+    
+   // Create the socket.
+   socketHandle = ::socket(AF_INET, SOCK_STREAM, 0);
+   if( socketHandle < 0 ) {
+      socketHandle = INVALID_SOCKET_HANDLE;
+         throw SocketException( __FILE__, __LINE__, ::strerror( errno ) );
+   }
+   
+   // Check port value.
+   if (port <= 0 || port > 65535) {
+      close();
+       throw SocketException ( __FILE__, __LINE__, 
+          "Socket::connect- Port out of range: %d", port );
+   }
+    
+   sockaddr_in target_addr;
+   target_addr.sin_family = AF_INET;
+   target_addr.sin_port = htons((short)port);
+   target_addr.sin_addr.s_addr = 0; // To be set later down...
+   memset(&target_addr.sin_zero, 0, sizeof(target_addr.sin_zero));
+
+   // Resolve name
+   addrinfo hints;
+   memset(&hints, 0, sizeof(addrinfo));
+   hints.ai_family = PF_INET;
+   struct addrinfo *res_ptr = NULL;
+    
+   int status = ::getaddrinfo(host, NULL, &hints, &res_ptr);
+   if( status != 0 || res_ptr == NULL){      
+       throw SocketException( __FILE__, __LINE__, 
+          "Socket::connect - %s", ::strerror( errno ) );        
+   }
+    
+   assert(res_ptr->ai_addr->sa_family == AF_INET);
+   // Porting: On both 32bit and 64 bit systems that we compile to soo far, sin_addr 
+   // is a 32 bit value, not an unsigned long.
+   assert(sizeof(((sockaddr_in*)res_ptr->ai_addr)->sin_addr.s_addr) == 4);
+   target_addr.sin_addr.s_addr = ((sockaddr_in*)res_ptr->ai_addr)->sin_addr.s_addr;
+   freeaddrinfo(res_ptr);
+   
+   // Attempt the connection to the server.
+   status = ::connect(socketHandle, 
+                      (const sockaddr *)&target_addr, 
+                      sizeof(target_addr));
+                      
+   if( status < 0 ){
+       close();
+      throw SocketException( __FILE__, __LINE__, 
+         "Socket::connect - %s", ::strerror( errno ) );
+   }
+   
+   // Create an input/output stream for this socket.
+   inputStream = new SocketInputStream( socketHandle );
+   outputStream = new SocketOutputStream( socketHandle );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TcpSocket::close() throw( cms::CMSException )
+{
+   // Destroy the input stream.
+   if( inputStream != NULL ){
+      delete inputStream;
+      inputStream = NULL;
+   }
+   
+   // Destroy the output stream.
+   if( outputStream != NULL ){
+      delete outputStream;
+      outputStream = NULL;
+   }
+   
+   if( isConnected() )
+   {
+      
+      ::shutdown(socketHandle, 2);
+        
+      #if (defined(unix) || defined(__APPLE__)) && !defined(__CYGWIN__)
+         ::close(socketHandle);
+      #else
+         ::closesocket(socketHandle);
+      #endif
+      
+      socketHandle = INVALID_SOCKET_HANDLE;
+   }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int TcpSocket::getSoLinger() const throw(SocketException){
+   
+   linger value;
+   socklen_t length = sizeof(value);
+   ::getsockopt(socketHandle, SOL_SOCKET, SO_LINGER, (char*)&value, &length );
+   
+   return value.l_onoff? value.l_linger : 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////    
+void TcpSocket::setSoLinger( const int dolinger ) throw(SocketException){
+   
+   linger value;
+   value.l_onoff = dolinger != 0;
+   value.l_linger = dolinger;
+   ::setsockopt(socketHandle, SOL_SOCKET, SO_LINGER, (char*)&value, sizeof(value) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool TcpSocket::getKeepAlive() const throw(SocketException){
+   
+   int value;
+   socklen_t length = sizeof(int);
+   ::getsockopt(socketHandle, SOL_SOCKET, SO_KEEPALIVE, (char*)&value, &length );
+   return value != 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TcpSocket::setKeepAlive( const bool keepAlive ) throw(SocketException){
+   
+   int value = keepAlive? 1 : 0;
+   ::setsockopt(socketHandle, SOL_SOCKET, SO_KEEPALIVE, (char*)&value, sizeof(int) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int TcpSocket::getReceiveBufferSize() const throw(SocketException){
+   
+   int value;
+   socklen_t length = sizeof(int);
+   ::getsockopt(socketHandle, SOL_SOCKET, SO_RCVBUF, (char*)&value, &length );
+   return value;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TcpSocket::setReceiveBufferSize( const int size ) throw(SocketException){
+   
+   ::setsockopt(socketHandle, SOL_SOCKET, SO_RCVBUF, (char*)&size, sizeof(int) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool TcpSocket::getReuseAddress() const throw(SocketException){
+   
+   int value;
+   socklen_t length = sizeof(int);
+   ::getsockopt(socketHandle, SOL_SOCKET, SO_REUSEADDR, (char*)&value, &length );
+   return value != 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TcpSocket::setReuseAddress( const bool reuse ) throw(SocketException){
+   
+   int value = reuse? 1 : 0;
+   ::setsockopt(socketHandle, SOL_SOCKET, SO_REUSEADDR, (char*)&value, sizeof(int) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int TcpSocket::getSendBufferSize() const throw(SocketException){
+   
+   int value;
+   socklen_t length = sizeof(int);
+   ::getsockopt(socketHandle, SOL_SOCKET, SO_SNDBUF, (char*)&value, &length );
+   return value;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TcpSocket::setSendBufferSize( const int size ) throw(SocketException){
+   
+   ::setsockopt(socketHandle, SOL_SOCKET, SO_SNDBUF, (char*)&size, sizeof(int) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TcpSocket::setSoTimeout ( const int millisecs ) throw (SocketException)
+{
+#if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+  timeval timot;
+  timot.tv_sec = millisecs / 1000;
+  timot.tv_usec = (millisecs % 1000) * 1000;
+#else
+  int timot = millisecs;
+#endif
+
+  ::setsockopt(socketHandle, SOL_SOCKET, SO_RCVTIMEO, (const char*) &timot, sizeof (timot));
+  ::setsockopt(socketHandle, SOL_SOCKET, SO_SNDTIMEO, (const char*) &timot, sizeof (timot));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int TcpSocket::getSoTimeout() const throw(SocketException)
+{
+#if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+  timeval timot;
+  timot.tv_sec = 0;
+  timot.tv_usec = 0;
+  socklen_t size = sizeof(timot);
+#else
+  int timot = 0;
+  int size = sizeof(timot);
+#endif
+  
+  ::getsockopt(socketHandle, SOL_SOCKET, SO_RCVTIMEO, (char*) &timot, &size);
+  
+#if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+  return (timot.tv_sec * 1000) + (timot.tv_usec / 1000);
+#else
+  return timot;
+#endif
+}
+

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.h Wed Jul  5 15:27:34 2006
@@ -1,234 +1,234 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ACTIVEMQ_NETWORK_SOCKET_H
-#define ACTIVEMQ_NETWORK_SOCKET_H
-
-#include <activemq/network/SocketException.h>
-#include <activemq/network/Socket.h>
-#include <activemq/io/InputStream.h>
-#include <activemq/io/OutputStream.h>
-
-namespace activemq{
-namespace network{
-   
-   // Forward declarations
-   class SocketInputStream;
-   class SocketOutputStream;
-   
-   /**
-    * Platform-independent implementation of the socket interface.
-    */
-   class TcpSocket : public Socket
-   {      
-   private:
-   
-      /**
-       * The handle for this socket.
-       */
-       SocketHandle socketHandle;
-       
-       /**
-        * The input stream for reading this socket.
-        */
-       SocketInputStream* inputStream;
-       
-       /**
-        * The output stream for writing to this socket.
-        */
-       SocketOutputStream* outputStream;
-       
-   public:
-   
-       /** 
-        * Construct a non-connected socket.
-        */
-       TcpSocket();
-       
-       /** 
-        * Construct a connected or bound socket based on given
-        * socket handle.
-        */
-       TcpSocket(SocketHandle socketHandle);
-       
-       /**
-        * Destruct.
-        * Releases the socket handle but not
-        * gracefully shut down the connection.
-        */
-       virtual ~TcpSocket();
-       
-      /**
-       * Gets the handle for the socket.
-       */
-       SocketHandle getSocketHandle () {
-           return socketHandle;
-       }
-   
-       /**
-       * Connects to the specified destination. Closes this socket if 
-       * connected to another destination.
-       * @param host The host of the server to connect to.
-       * @param port The port of the server to connect to.
-       * @throws IOException Thrown if a failure occurred in the connect.
-       */
-      virtual void connect( const char* host, const int port ) throw(SocketException);
-      
-      /**
-       * Indicates whether or not this socket is connected to a destination.
-       */
-      virtual bool isConnected() const{
-         return socketHandle != INVALID_SOCKET_HANDLE;
-      }
-      
-      /**
-       * Gets the InputStream for this socket.
-       * @return The InputStream for this socket. NULL if not connected.
-       */
-      virtual io::InputStream* getInputStream();
-      
-      /**
-       * Gets the OutputStream for this socket.
-       * @return the OutputStream for this socket.  NULL if not connected.
-       */
-      virtual io::OutputStream* getOutputStream();
-      
-      /**
-       * Gets the linger time.
-       * @return The linger time in seconds.
-       * @throws SocketException if the operation fails.
-       */
-      virtual int getSoLinger() const throw(SocketException);
-      
-      /**
-       * Sets the linger time.
-       * @param linger The linger time in seconds.  If 0, linger is off.
-       * @throws SocketException if the operation fails.
-       */
-      virtual void setSoLinger( const int linger ) throw(SocketException);
-      
-      /**
-       * Gets the keep alive flag.
-       * @return True if keep alive is enabled.
-       * @throws SocketException if the operation fails.
-       */
-      virtual bool getKeepAlive() const throw(SocketException);
-      
-      /**
-       * Enables/disables the keep alive flag.
-       * @param keepAlive If true, enables the flag.
-       * @throws SocketException if the operation fails.
-       */
-      virtual void setKeepAlive( const bool keepAlive ) throw(SocketException);
-      
-      /**
-       * Gets the receive buffer size.
-       * @return the receive buffer size in bytes.
-       * @throws SocketException if the operation fails.
-       */
-      virtual int getReceiveBufferSize() const throw(SocketException);
-      
-      /**
-       * Sets the recieve buffer size.
-       * @param size Number of bytes to set the receive buffer to.
-       * @throws SocketException if the operation fails.
-       */
-      virtual void setReceiveBufferSize( const int size ) throw(SocketException);
-      
-      /**
-       * Gets the reuse address flag.
-       * @return True if the address can be reused.
-       * @throws SocketException if the operation fails.
-       */
-      virtual bool getReuseAddress() const throw(SocketException);
-      
-      /**
-       * Sets the reuse address flag.
-       * @param reuse If true, sets the flag.
-       * @throws SocketException if the operation fails.
-       */
-      virtual void setReuseAddress( const bool reuse ) throw(SocketException);
-      
-      /**
-       * Gets the send buffer size.
-       * @return the size in bytes of the send buffer.
-       * @throws SocketException if the operation fails.
-       */
-      virtual int getSendBufferSize() const throw(SocketException);
-      
-      /**
-       * Sets the send buffer size.
-       * @param size The number of bytes to set the send buffer to.
-       * @throws SocketException if the operation fails.
-       */
-      virtual void setSendBufferSize( const int size ) throw(SocketException);
-      
-      /**
-       * Gets the timeout for socket operations.
-       * @return The timeout in milliseconds for socket operations.
-       * @throws SocketException Thrown if unable to retrieve the information.
-       */
-      virtual int getSoTimeout() const throw(SocketException);
-      
-      /**
-       * Sets the timeout for socket operations.
-       * @param timeout The timeout in milliseconds for socket operations.<p>
-       * @throws SocketException Thrown if unable to set the information.
-       */
-      virtual void setSoTimeout( const int timeout ) throw(SocketException);
-
-      /**
-       * Closes this object and deallocates the appropriate resources.
-       * @throws CMSException
-       */
-      virtual void close() throw( cms::CMSException );
-       
-   protected:
-   
-      #if !defined( unix ) || defined( __CYGWIN__ )
-      
-         // WINDOWS needs initialization of winsock
-         class StaticSocketInitializer {
-         private:
-          
-            SocketException* socketInitError;
-              
-            void clear(){
-               if( socketInitError != NULL ){
-                  delete socketInitError;
-               }
-               socketInitError = NULL;
-            }
-              
-         public:
-
-            SocketException* getSocketInitError () {
-               return socketInitError;
-            }
-
-            StaticSocketInitializer();
-            virtual ~StaticSocketInitializer ();
-
-         };
-          
-         static StaticSocketInitializer staticSocketInitializer;
-      #endif
-   
-   };
-
-}}
-
-#endif /*ACTIVEMQ_NETWORK_SOCKET_H*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ACTIVEMQ_NETWORK_SOCKET_H
+#define ACTIVEMQ_NETWORK_SOCKET_H
+
+#include <activemq/network/SocketException.h>
+#include <activemq/network/Socket.h>
+#include <activemq/io/InputStream.h>
+#include <activemq/io/OutputStream.h>
+
+namespace activemq{
+namespace network{
+   
+   // Forward declarations
+   class SocketInputStream;
+   class SocketOutputStream;
+   
+   /**
+    * Platform-independent implementation of the socket interface.
+    */
+   class TcpSocket : public Socket
+   {      
+   private:
+   
+      /**
+       * The handle for this socket.
+       */
+       SocketHandle socketHandle;
+       
+       /**
+        * The input stream for reading this socket.
+        */
+       SocketInputStream* inputStream;
+       
+       /**
+        * The output stream for writing to this socket.
+        */
+       SocketOutputStream* outputStream;
+       
+   public:
+   
+       /** 
+        * Construct a non-connected socket.
+        */
+       TcpSocket();
+       
+       /** 
+        * Construct a connected or bound socket based on given
+        * socket handle.
+        */
+       TcpSocket(SocketHandle socketHandle);
+       
+       /**
+        * Destruct.
+        * Releases the socket handle but not
+        * gracefully shut down the connection.
+        */
+       virtual ~TcpSocket();
+       
+      /**
+       * Gets the handle for the socket.
+       */
+       SocketHandle getSocketHandle () {
+           return socketHandle;
+       }
+   
+       /**
+       * Connects to the specified destination. Closes this socket if 
+       * connected to another destination.
+       * @param host The host of the server to connect to.
+       * @param port The port of the server to connect to.
+       * @throws IOException Thrown if a failure occurred in the connect.
+       */
+      virtual void connect( const char* host, const int port ) throw(SocketException);
+      
+      /**
+       * Indicates whether or not this socket is connected to a destination.
+       */
+      virtual bool isConnected() const{
+         return socketHandle != INVALID_SOCKET_HANDLE;
+      }
+      
+      /**
+       * Gets the InputStream for this socket.
+       * @return The InputStream for this socket. NULL if not connected.
+       */
+      virtual io::InputStream* getInputStream();
+      
+      /**
+       * Gets the OutputStream for this socket.
+       * @return the OutputStream for this socket.  NULL if not connected.
+       */
+      virtual io::OutputStream* getOutputStream();
+      
+      /**
+       * Gets the linger time.
+       * @return The linger time in seconds.
+       * @throws SocketException if the operation fails.
+       */
+      virtual int getSoLinger() const throw(SocketException);
+      
+      /**
+       * Sets the linger time.
+       * @param linger The linger time in seconds.  If 0, linger is off.
+       * @throws SocketException if the operation fails.
+       */
+      virtual void setSoLinger( const int linger ) throw(SocketException);
+      
+      /**
+       * Gets the keep alive flag.
+       * @return True if keep alive is enabled.
+       * @throws SocketException if the operation fails.
+       */
+      virtual bool getKeepAlive() const throw(SocketException);
+      
+      /**
+       * Enables/disables the keep alive flag.
+       * @param keepAlive If true, enables the flag.
+       * @throws SocketException if the operation fails.
+       */
+      virtual void setKeepAlive( const bool keepAlive ) throw(SocketException);
+      
+      /**
+       * Gets the receive buffer size.
+       * @return the receive buffer size in bytes.
+       * @throws SocketException if the operation fails.
+       */
+      virtual int getReceiveBufferSize() const throw(SocketException);
+      
+      /**
+       * Sets the recieve buffer size.
+       * @param size Number of bytes to set the receive buffer to.
+       * @throws SocketException if the operation fails.
+       */
+      virtual void setReceiveBufferSize( const int size ) throw(SocketException);
+      
+      /**
+       * Gets the reuse address flag.
+       * @return True if the address can be reused.
+       * @throws SocketException if the operation fails.
+       */
+      virtual bool getReuseAddress() const throw(SocketException);
+      
+      /**
+       * Sets the reuse address flag.
+       * @param reuse If true, sets the flag.
+       * @throws SocketException if the operation fails.
+       */
+      virtual void setReuseAddress( const bool reuse ) throw(SocketException);
+      
+      /**
+       * Gets the send buffer size.
+       * @return the size in bytes of the send buffer.
+       * @throws SocketException if the operation fails.
+       */
+      virtual int getSendBufferSize() const throw(SocketException);
+      
+      /**
+       * Sets the send buffer size.
+       * @param size The number of bytes to set the send buffer to.
+       * @throws SocketException if the operation fails.
+       */
+      virtual void setSendBufferSize( const int size ) throw(SocketException);
+      
+      /**
+       * Gets the timeout for socket operations.
+       * @return The timeout in milliseconds for socket operations.
+       * @throws SocketException Thrown if unable to retrieve the information.
+       */
+      virtual int getSoTimeout() const throw(SocketException);
+      
+      /**
+       * Sets the timeout for socket operations.
+       * @param timeout The timeout in milliseconds for socket operations.<p>
+       * @throws SocketException Thrown if unable to set the information.
+       */
+      virtual void setSoTimeout( const int timeout ) throw(SocketException);
+
+      /**
+       * Closes this object and deallocates the appropriate resources.
+       * @throws CMSException
+       */
+      virtual void close() throw( cms::CMSException );
+       
+   protected:
+   
+      #if !defined( unix ) || defined( __CYGWIN__ )
+      
+         // WINDOWS needs initialization of winsock
+         class StaticSocketInitializer {
+         private:
+          
+            SocketException* socketInitError;
+              
+            void clear(){
+               if( socketInitError != NULL ){
+                  delete socketInitError;
+               }
+               socketInitError = NULL;
+            }
+              
+         public:
+
+            SocketException* getSocketInitError () {
+               return socketInitError;
+            }
+
+            StaticSocketInitializer();
+            virtual ~StaticSocketInitializer ();
+
+         };
+          
+         static StaticSocketInitializer staticSocketInitializer;
+      #endif
+   
+   };
+
+}}
+
+#endif /*ACTIVEMQ_NETWORK_SOCKET_H*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/InitDirector.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/InitDirector.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/InitDirector.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/InitDirector.cpp Wed Jul  5 15:27:34 2006
@@ -1,51 +1,51 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "InitDirector.h"
-
-#include <activemq/logger/LogWriter.h>
-#include <activemq/transport/IOTransportFactory.h>
-#include <activemq/transport/TcpTransportFactory.h>
-#include <activemq/connector/stomp/StompConnectorFactory.h>
-
-using namespace activemq;
-using namespace activemq::support;
-
-int InitDirector::refCount;
-
-////////////////////////////////////////////////////////////////////////////////
-InitDirector::InitDirector(void)
-{
-    if( refCount == 0 )
-    {
-        logger::LogWriter::getInstance();
-        connector::stomp::StompConnectorFactory::getInstance();
-        transport::TcpTransportFactory::getInstance();
-        transport::IOTransportFactory::getInstance();
-    }
-    
-    refCount++;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-InitDirector::~InitDirector(void)
-{
-    refCount--;
-    
-    if( refCount == 0 )
-    {
-    }
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "InitDirector.h"
+
+#include <activemq/logger/LogWriter.h>
+#include <activemq/transport/IOTransportFactory.h>
+#include <activemq/transport/TcpTransportFactory.h>
+#include <activemq/connector/stomp/StompConnectorFactory.h>
+
+using namespace activemq;
+using namespace activemq::support;
+
+int InitDirector::refCount;
+
+////////////////////////////////////////////////////////////////////////////////
+InitDirector::InitDirector(void)
+{
+    if( refCount == 0 )
+    {
+        logger::LogWriter::getInstance();
+        connector::stomp::StompConnectorFactory::getInstance();
+        transport::TcpTransportFactory::getInstance();
+        transport::IOTransportFactory::getInstance();
+    }
+    
+    refCount++;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+InitDirector::~InitDirector(void)
+{
+    refCount--;
+    
+    if( refCount == 0 )
+    {
+    }
+}

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/InitDirector.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/InitDirector.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/InitDirector.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/InitDirector.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/InitDirector.h Wed Jul  5 15:27:34 2006
@@ -1,46 +1,46 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _ACTIVEMQ_SUPPORT_INITDIRECTOR_H_
-#define _ACTIVEMQ_SUPPORT_INITDIRECTOR_H_
-
-namespace activemq{
-namespace support{
-
-    /*
-     * Create a static instance of this class to init all static data
-     * in order in this library.
-     * Each package that needs initalization should create a set of
-     * functions that control init and cleanup.  Each should be called
-     * by this class init in the constructor and cleanup in the 
-     * destructor
-     */
-    class InitDirector
-    {
-    private:
-    
-        static int refCount;
-        
-    public:
-
-    	InitDirector(void);
-    	virtual ~InitDirector(void);
-
-    };
-
-}}
-
-#endif /*_ACTIVEMQ_SUPPORT_INITDIRECTOR_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _ACTIVEMQ_SUPPORT_INITDIRECTOR_H_
+#define _ACTIVEMQ_SUPPORT_INITDIRECTOR_H_
+
+namespace activemq{
+namespace support{
+
+    /*
+     * Create a static instance of this class to init all static data
+     * in order in this library.
+     * Each package that needs initalization should create a set of
+     * functions that control init and cleanup.  Each should be called
+     * by this class init in the constructor and cleanup in the 
+     * destructor
+     */
+    class InitDirector
+    {
+    private:
+    
+        static int refCount;
+        
+    public:
+
+    	InitDirector(void);
+    	virtual ~InitDirector(void);
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_SUPPORT_INITDIRECTOR_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/InitDirector.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/LibraryInit.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/LibraryInit.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/LibraryInit.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/LibraryInit.h Wed Jul  5 15:27:34 2006
@@ -1,28 +1,28 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _ACTIVEMQ_SUPPORT_LIBRARY_INIT_H
-#define _ACTIVEMQ_SUPPORT_LIBRARY_INIT_H
-
-#include <activemq/support/InitDirector.h>
-
-// Hide in a no name namespace, avoid any collisions
-namespace {
-    static activemq::support::InitDirector initDirector;
-}
-
-#endif /*_ACTIVEMQ_SUPPORT_LIBRARY_INIT_H*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_SUPPORT_LIBRARY_INIT_H
+#define _ACTIVEMQ_SUPPORT_LIBRARY_INIT_H
+
+#include <activemq/support/InitDirector.h>
+
+// Hide in a no name namespace, avoid any collisions
+namespace {
+    static activemq::support::InitDirector initDirector;
+}
+
+#endif /*_ACTIVEMQ_SUPPORT_LIBRARY_INIT_H*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/support/LibraryInit.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/BrokerError.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Command.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/CommandIOException.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/CommandListener.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/CommandListener.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/CommandListener.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/CommandListener.h Wed Jul  5 15:27:34 2006
@@ -1,44 +1,44 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- 
-#ifndef ACTIVEMQ_TRANSPORT_COMMANDLISTENER_H_
-#define ACTIVEMQ_TRANSPORT_COMMANDLISTENER_H_
-
-#include <activemq/transport/Command.h>
-
-namespace activemq{
-namespace transport{
-  
-    /**
-     * Interface for an observer of broker commands.
-     */
-    class CommandListener{
-    public:
-  
-        virtual ~CommandListener(void){}
-     
-        /**
-         * Event handler for the receipt of a command.
-         * @param command the received command object.
-         */
-        virtual void onCommand( Command* command ) = 0;
-        
-    };
-    
-}}
-
-#endif /*ACTIVEMQ_TRANSPORT_COMMANDLISTENER_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#ifndef ACTIVEMQ_TRANSPORT_COMMANDLISTENER_H_
+#define ACTIVEMQ_TRANSPORT_COMMANDLISTENER_H_
+
+#include <activemq/transport/Command.h>
+
+namespace activemq{
+namespace transport{
+  
+    /**
+     * Interface for an observer of broker commands.
+     */
+    class CommandListener{
+    public:
+  
+        virtual ~CommandListener(void){}
+     
+        /**
+         * Event handler for the receipt of a command.
+         * @param command the received command object.
+         */
+        virtual void onCommand( Command* command ) = 0;
+        
+    };
+    
+}}
+
+#endif /*ACTIVEMQ_TRANSPORT_COMMANDLISTENER_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/CommandListener.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/CommandReader.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/CommandWriter.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/ExceptionResponse.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/FutureResponse.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/IOTransportFactory.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/IOTransportFactory.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Response.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/ResponseCorrelator.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/ResponseCorrelator.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransport.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransport.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransport.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransport.cpp Wed Jul  5 15:27:34 2006
@@ -1,73 +1,73 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "TcpTransport.h"
-
-#include <activemq/network/SocketFactory.h>
-#include <activemq/transport/IOTransport.h>
-#include <activemq/transport/TransportFactory.h>
-#include <activemq/transport/TransportFactoryMap.h>
-
-using namespace std;
-using namespace activemq;
-using namespace activemq::transport;
-using namespace activemq::network;
-using namespace activemq::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-TcpTransport::TcpTransport( const activemq::util::Properties& properties,
-                            Transport* next, 
-                            const bool own )
- : TransportFilter( next, own )
-{
-    try
-    {
-        // Create the IO device we will be communicating over the
-        // wire with.  This may need to change if we add more types
-        // of sockets, such as SSL.  
-        socket = SocketFactory::createSocket(properties);
-
-        // Cast it to an IO transport so we can wire up the socket
-        // input and output streams.
-        IOTransport* ioTransport = dynamic_cast<IOTransport*>( next );
-        if( ioTransport == NULL ){
-            throw ActiveMQException( 
-                __FILE__, __LINE__, 
-                "TcpTransport::TcpTransport - "
-                "transport must be of type IOTransport");
-        }
-
-        // Give the IOTransport the streams from out TCP socket.        
-        ioTransport->setInputStream( socket->getInputStream() );
-        ioTransport->setOutputStream( socket->getOutputStream() );
-    }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-TcpTransport::~TcpTransport(void)
-{
-    try
-    {
-        socket->close();
-        delete socket;
-    }
-    AMQ_CATCH_NOTHROW( ActiveMQException )
-    AMQ_CATCHALL_NOTHROW( )
-}
-
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TcpTransport.h"
+
+#include <activemq/network/SocketFactory.h>
+#include <activemq/transport/IOTransport.h>
+#include <activemq/transport/TransportFactory.h>
+#include <activemq/transport/TransportFactoryMap.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::transport;
+using namespace activemq::network;
+using namespace activemq::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+TcpTransport::TcpTransport( const activemq::util::Properties& properties,
+                            Transport* next, 
+                            const bool own )
+ : TransportFilter( next, own )
+{
+    try
+    {
+        // Create the IO device we will be communicating over the
+        // wire with.  This may need to change if we add more types
+        // of sockets, such as SSL.  
+        socket = SocketFactory::createSocket(properties);
+
+        // Cast it to an IO transport so we can wire up the socket
+        // input and output streams.
+        IOTransport* ioTransport = dynamic_cast<IOTransport*>( next );
+        if( ioTransport == NULL ){
+            throw ActiveMQException( 
+                __FILE__, __LINE__, 
+                "TcpTransport::TcpTransport - "
+                "transport must be of type IOTransport");
+        }
+
+        // Give the IOTransport the streams from out TCP socket.        
+        ioTransport->setInputStream( socket->getInputStream() );
+        ioTransport->setOutputStream( socket->getOutputStream() );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+TcpTransport::~TcpTransport(void)
+{
+    try
+    {
+        socket->close();
+        delete socket;
+    }
+    AMQ_CATCH_NOTHROW( ActiveMQException )
+    AMQ_CATCHALL_NOTHROW( )
+}
+

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransport.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransport.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransport.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransport.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransport.h Wed Jul  5 15:27:34 2006
@@ -1,54 +1,54 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _ACTIVEMQ_TRANSPORT_TCPTRANSPORT_H_
-#define _ACTIVEMQ_TRANSPORT_TCPTRANSPORT_H_
-
-#include <activemq/transport/TransportFilter.h>
-#include <activemq/network/Socket.h>
-#include <activemq/util/Properties.h>
-
-namespace activemq{
-namespace transport{
-
-    /**
-     * Implements a TCP/IP based transport filter, this transport
-     * is meant to wrap an instance of an IOTransport.  The lower
-     * level transport should take care of manaing stream reads
-     * and writes.
-     */
-    class TcpTransport : public TransportFilter 
-    {
-    private:
-
-        /**
-         * Socket that this Transport Communicates with
-         */
-        network::Socket* socket;
-
-    public:
-
-    	TcpTransport( const activemq::util::Properties& properties,
-                      Transport* next, 
-                      const bool own = true );
-    	virtual ~TcpTransport(void);
-
-    };
-
-}}
-
-#endif /*_ACTIVEMQ_TRANSPORT_TCPTRANSPORT_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_TRANSPORT_TCPTRANSPORT_H_
+#define _ACTIVEMQ_TRANSPORT_TCPTRANSPORT_H_
+
+#include <activemq/transport/TransportFilter.h>
+#include <activemq/network/Socket.h>
+#include <activemq/util/Properties.h>
+
+namespace activemq{
+namespace transport{
+
+    /**
+     * Implements a TCP/IP based transport filter, this transport
+     * is meant to wrap an instance of an IOTransport.  The lower
+     * level transport should take care of manaing stream reads
+     * and writes.
+     */
+    class TcpTransport : public TransportFilter 
+    {
+    private:
+
+        /**
+         * Socket that this Transport Communicates with
+         */
+        network::Socket* socket;
+
+    public:
+
+    	TcpTransport( const activemq::util::Properties& properties,
+                      Transport* next, 
+                      const bool own = true );
+    	virtual ~TcpTransport(void);
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_TRANSPORT_TCPTRANSPORT_H_*/

Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransport.h
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message