You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2006/07/06 00:27:47 UTC

svn commit: r419365 [16/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...

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.cpp Wed Jul  5 15:27:34 2006
@@ -1,121 +1,121 @@
-/*
- * 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 "BufferedSocket.h"
-
-#include <activemq/exceptions/IllegalArgumentException.h>
-
-using namespace activemq;
-using namespace activemq::network;
-using namespace activemq::io;
-using namespace activemq::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-BufferedSocket::BufferedSocket(Socket* socket,
-                               unsigned int inputBufferSize,
-                               unsigned int outputBufferSize,
-                               bool own)
-{
-   if(socket == NULL)
-   {
-      throw IllegalArgumentException(
-         __FILE__, __LINE__,
-         "BufferedSocket::BufferedSocket - Constructed with NULL Socket");
-   }
-   
-   this->socket = socket;
-   this->inputBufferSize = inputBufferSize;
-   this->outputBufferSize = outputBufferSize;
-   this->own = own;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-BufferedSocket::~BufferedSocket(void)
-{
-   try
-   {
-      if(outputStream)
-      {
-         // Ensure all data is written
-         outputStream->flush();
-      }
-
-      // Close the socket      
-      socket->close();
-         
-      // if we own it, delete it.
-      if(own)
-      {
-         delete socket;
-      }
-      
-      // Clean up our streams.
-      delete inputStream;
-      delete outputStream;
-   }
-   AMQ_CATCH_NOTHROW( ActiveMQException )
-   AMQ_CATCHALL_NOTHROW( )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BufferedSocket::connect( const char* host, const int port ) 
-   throw( SocketException )
-{
-   try
-   {      
-      if( socket->isConnected() )
-      {
-         throw SocketException( __FILE__, __LINE__, 
-               "BufferedSocket::connect() - socket already connected" );
-      }
-
-      // Connect the socket.
-      socket->connect( host, port );
-
-      // Now create the buffered streams that wrap around the socket.
-      inputStream = new BufferedInputStream( 
-         socket->getInputStream(), inputBufferSize );
-      outputStream = new BufferedOutputStream( 
-         socket->getOutputStream(), outputBufferSize );
-   }
-   AMQ_CATCH_RETHROW( SocketException )
-   AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, SocketException )
-   AMQ_CATCHALL_THROW( SocketException )   
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void BufferedSocket::close(void) throw( cms::CMSException )
-{
-   try
-   {
-      // Ensure all data writen
-      outputStream->flush();
-      
-      // Close the Socket
-      socket->close();
-      
-      // Remove old stream, recreate if reconnected
-      delete inputStream;
-      delete outputStream;
-      
-      inputStream = NULL;
-      outputStream = NULL;
-   }
-   AMQ_CATCH_RETHROW( SocketException )
-   AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, SocketException )
-   AMQ_CATCHALL_THROW( SocketException )   
-}
+/*
+ * 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 "BufferedSocket.h"
+
+#include <activemq/exceptions/IllegalArgumentException.h>
+
+using namespace activemq;
+using namespace activemq::network;
+using namespace activemq::io;
+using namespace activemq::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+BufferedSocket::BufferedSocket(Socket* socket,
+                               unsigned int inputBufferSize,
+                               unsigned int outputBufferSize,
+                               bool own)
+{
+   if(socket == NULL)
+   {
+      throw IllegalArgumentException(
+         __FILE__, __LINE__,
+         "BufferedSocket::BufferedSocket - Constructed with NULL Socket");
+   }
+   
+   this->socket = socket;
+   this->inputBufferSize = inputBufferSize;
+   this->outputBufferSize = outputBufferSize;
+   this->own = own;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+BufferedSocket::~BufferedSocket(void)
+{
+   try
+   {
+      if(outputStream)
+      {
+         // Ensure all data is written
+         outputStream->flush();
+      }
+
+      // Close the socket      
+      socket->close();
+         
+      // if we own it, delete it.
+      if(own)
+      {
+         delete socket;
+      }
+      
+      // Clean up our streams.
+      delete inputStream;
+      delete outputStream;
+   }
+   AMQ_CATCH_NOTHROW( ActiveMQException )
+   AMQ_CATCHALL_NOTHROW( )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void BufferedSocket::connect( const char* host, const int port ) 
+   throw( SocketException )
+{
+   try
+   {      
+      if( socket->isConnected() )
+      {
+         throw SocketException( __FILE__, __LINE__, 
+               "BufferedSocket::connect() - socket already connected" );
+      }
+
+      // Connect the socket.
+      socket->connect( host, port );
+
+      // Now create the buffered streams that wrap around the socket.
+      inputStream = new BufferedInputStream( 
+         socket->getInputStream(), inputBufferSize );
+      outputStream = new BufferedOutputStream( 
+         socket->getOutputStream(), outputBufferSize );
+   }
+   AMQ_CATCH_RETHROW( SocketException )
+   AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, SocketException )
+   AMQ_CATCHALL_THROW( SocketException )   
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void BufferedSocket::close(void) throw( cms::CMSException )
+{
+   try
+   {
+      // Ensure all data writen
+      outputStream->flush();
+      
+      // Close the Socket
+      socket->close();
+      
+      // Remove old stream, recreate if reconnected
+      delete inputStream;
+      delete outputStream;
+      
+      inputStream = NULL;
+      outputStream = NULL;
+   }
+   AMQ_CATCH_RETHROW( SocketException )
+   AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, SocketException )
+   AMQ_CATCHALL_THROW( SocketException )   
+}

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

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/BufferedSocket.h Wed Jul  5 15:27:34 2006
@@ -1,220 +1,220 @@
-/*
- * 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_BUFFEREDSOCKET_H_
-#define _ACTIVEMQ_NETWORK_BUFFEREDSOCKET_H_
-
-#include <activemq/network/Socket.h>
-#include <activemq/network/SocketException.h>
-#include <activemq/io/BufferedInputStream.h>
-#include <activemq/io/BufferedOutputStream.h>
-
-namespace activemq{
-namespace network{
-
-   /**
-    * Buffered Socket class that wraps a <code>Socket</code> derived
-    * object and provides Buffered input and Output Streams to improce
-    * the efficiency of the reads and writes.
-    */
-   class BufferedSocket : public Socket
-   {
-   private:
-   
-      // Socket that this class wraps to provide buffering
-      Socket* socket;
-      
-      // Indicates if the lifetime of the Socket is controlled by this 
-      // class.  If true Socket is deleted at destruction.
-      bool own;
-      
-      // Buffered Input stream to wrap the Socket input stream
-      io::BufferedInputStream* inputStream;
-      
-      // Buffered Output stream to wrap the Socket input stream
-      io::BufferedOutputStream* outputStream;
-      
-      // Sizes for the Buffered Streams
-      unsigned int inputBufferSize;
-      unsigned int outputBufferSize;
-
-   public:
-
-      /**
-       * Constructor
-       */
-   	BufferedSocket(Socket* socket, 
-                     unsigned int inputBufferSize = 1000,
-                     unsigned int outputBufferSize = 1000,
-                     bool own = true);
-
-      /**
-       * Destructor
-       */
-   	virtual ~BufferedSocket(void);
-
-       /**
-       * 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);
-      
-      /**
-       * Closes this object and deallocates the appropriate resources.
-       * @throws CMSException
-       */
-      virtual void close() throw( cms::CMSException );
-
-      /**
-       * Indicates whether or not this socket is connected to a destination.
-       */
-      virtual bool isConnected() const{
-         return socket->isConnected();
-      }
-
-      /**
-       * Gets the InputStream for this socket.
-       * @return The InputStream for this socket. NULL if not connected.
-       */
-      virtual io::InputStream* getInputStream(){
-         return inputStream;
-      }
-      
-      /**
-       * Gets the OutputStream for this socket.
-       * @return the OutputStream for this socket.  NULL if not connected.
-       */
-      virtual io::OutputStream* getOutputStream(){
-         return outputStream;
-      }
-
-      /**
-       * Gets the linger time.
-       * @return The linger time in seconds.
-       * @throws SocketException if the operation fails.
-       */
-      virtual int getSoLinger() const throw(SocketException){
-         return socket->getSoLinger();
-      }
-      
-      /**
-       * 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){
-         socket->setSoLinger(linger);
-      }
-      
-      /**
-       * Gets the keep alive flag.
-       * @return True if keep alive is enabled.
-       * @throws SocketException if the operation fails.
-       */
-      virtual bool getKeepAlive() const throw(SocketException){
-         return socket->getKeepAlive();
-      }
-      
-      /**
-       * 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){
-         socket->setKeepAlive(keepAlive);
-      }
-      
-      /**
-       * Gets the receive buffer size.
-       * @return the receive buffer size in bytes.
-       * @throws SocketException if the operation fails.
-       */
-      virtual int getReceiveBufferSize() const throw(SocketException){
-         return socket->getReceiveBufferSize();
-      }
-      
-      /**
-       * 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){
-         socket->setReceiveBufferSize(size);
-      }
-      
-      /**
-       * 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){
-         return socket->getReuseAddress();
-      }
-      
-      /**
-       * 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){
-         socket->setReuseAddress(reuse);
-      }
-      
-      /**
-       * 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){
-         return socket->getSendBufferSize();
-      }
-      
-      /**
-       * 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){
-         socket->setSendBufferSize(size);
-      }
-      
-      /**
-       * 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){
-         return socket->getSoTimeout();
-      }
-      
-      /**
-       * 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){
-         socket->setSoTimeout(timeout);
-      }
-
-   };
-
-}}
-
-#endif /*_ACTIVEMQ_NETWORK_BUFFEREDSOCKET_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_BUFFEREDSOCKET_H_
+#define _ACTIVEMQ_NETWORK_BUFFEREDSOCKET_H_
+
+#include <activemq/network/Socket.h>
+#include <activemq/network/SocketException.h>
+#include <activemq/io/BufferedInputStream.h>
+#include <activemq/io/BufferedOutputStream.h>
+
+namespace activemq{
+namespace network{
+
+   /**
+    * Buffered Socket class that wraps a <code>Socket</code> derived
+    * object and provides Buffered input and Output Streams to improce
+    * the efficiency of the reads and writes.
+    */
+   class BufferedSocket : public Socket
+   {
+   private:
+   
+      // Socket that this class wraps to provide buffering
+      Socket* socket;
+      
+      // Indicates if the lifetime of the Socket is controlled by this 
+      // class.  If true Socket is deleted at destruction.
+      bool own;
+      
+      // Buffered Input stream to wrap the Socket input stream
+      io::BufferedInputStream* inputStream;
+      
+      // Buffered Output stream to wrap the Socket input stream
+      io::BufferedOutputStream* outputStream;
+      
+      // Sizes for the Buffered Streams
+      unsigned int inputBufferSize;
+      unsigned int outputBufferSize;
+
+   public:
+
+      /**
+       * Constructor
+       */
+   	BufferedSocket(Socket* socket, 
+                     unsigned int inputBufferSize = 1000,
+                     unsigned int outputBufferSize = 1000,
+                     bool own = true);
+
+      /**
+       * Destructor
+       */
+   	virtual ~BufferedSocket(void);
+
+       /**
+       * 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);
+      
+      /**
+       * Closes this object and deallocates the appropriate resources.
+       * @throws CMSException
+       */
+      virtual void close() throw( cms::CMSException );
+
+      /**
+       * Indicates whether or not this socket is connected to a destination.
+       */
+      virtual bool isConnected() const{
+         return socket->isConnected();
+      }
+
+      /**
+       * Gets the InputStream for this socket.
+       * @return The InputStream for this socket. NULL if not connected.
+       */
+      virtual io::InputStream* getInputStream(){
+         return inputStream;
+      }
+      
+      /**
+       * Gets the OutputStream for this socket.
+       * @return the OutputStream for this socket.  NULL if not connected.
+       */
+      virtual io::OutputStream* getOutputStream(){
+         return outputStream;
+      }
+
+      /**
+       * Gets the linger time.
+       * @return The linger time in seconds.
+       * @throws SocketException if the operation fails.
+       */
+      virtual int getSoLinger() const throw(SocketException){
+         return socket->getSoLinger();
+      }
+      
+      /**
+       * 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){
+         socket->setSoLinger(linger);
+      }
+      
+      /**
+       * Gets the keep alive flag.
+       * @return True if keep alive is enabled.
+       * @throws SocketException if the operation fails.
+       */
+      virtual bool getKeepAlive() const throw(SocketException){
+         return socket->getKeepAlive();
+      }
+      
+      /**
+       * 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){
+         socket->setKeepAlive(keepAlive);
+      }
+      
+      /**
+       * Gets the receive buffer size.
+       * @return the receive buffer size in bytes.
+       * @throws SocketException if the operation fails.
+       */
+      virtual int getReceiveBufferSize() const throw(SocketException){
+         return socket->getReceiveBufferSize();
+      }
+      
+      /**
+       * 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){
+         socket->setReceiveBufferSize(size);
+      }
+      
+      /**
+       * 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){
+         return socket->getReuseAddress();
+      }
+      
+      /**
+       * 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){
+         socket->setReuseAddress(reuse);
+      }
+      
+      /**
+       * 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){
+         return socket->getSendBufferSize();
+      }
+      
+      /**
+       * 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){
+         socket->setSendBufferSize(size);
+      }
+      
+      /**
+       * 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){
+         return socket->getSoTimeout();
+      }
+      
+      /**
+       * 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){
+         socket->setSoTimeout(timeout);
+      }
+
+   };
+
+}}
+
+#endif /*_ACTIVEMQ_NETWORK_BUFFEREDSOCKET_H_*/

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

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/ServerSocket.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/ServerSocket.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/ServerSocket.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/ServerSocket.cpp Wed Jul  5 15:27:34 2006
@@ -1,204 +1,204 @@
-/*
- * 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
-   #ifdef errno
-   #undef errno
-   #endif
-   int errno;
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <assert.h>
-#include "ServerSocket.h"
-#include <errno.h>
-#include <string>
-
-using namespace activemq::network;
-
-#if !(defined( unix ) || defined(__APPLE__)) || defined( __CYGWIN__ )
-
-   // Static socket initializer needed for winsock
-
-   ServerSocket::StaticServerSocketInitializer::StaticServerSocketInitializer () {
-       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");
-       }
-   }
-   ServerSocket::StaticServerSocketInitializer::~StaticServerSocketInitializer () {
-      clear();
-      WSACleanup();
-   }
-   
-   // Create static instance of the socket initializer.
-   ServerSocket::StaticServerSocketInitializer 
-      ServerSocket::staticSocketInitializer;
-   
-#endif
-
-
-////////////////////////////////////////////////////////////////////////////////
-ServerSocket::ServerSocket()
-{
-   socketHandle = Socket::INVALID_SOCKET_HANDLE;
-   
-#if !(defined( unix ) || defined(__APPLE__)) || defined( __CYGWIN__ )
-   if (ServerSocket::staticSocketInitializer.getSocketInitError() != NULL) {
-      throw *ServerSocket::staticSocketInitializer.getSocketInitError();
-   }
-#endif
-}
-
-////////////////////////////////////////////////////////////////////////////////
-ServerSocket::~ServerSocket()
-{
-   // No shutdown, just close - dont want blocking destructor.
-   close();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ServerSocket::bind (const char* host, int port) throw (SocketException)
-{
-   bind (host, port, SOMAXCONN);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ServerSocket::bind (const char* host, int port, int backlog) throw (SocketException)
-{
-   if (isBound()) {
-      throw SocketException ( __FILE__, __LINE__, 
-         "ServerSocket::bind - Socket already bound" );
-   }
-    
-    // Create the socket.
-   socketHandle = ::socket(AF_INET, SOCK_STREAM, 0);
-   if (socketHandle < 0) {
-      socketHandle = Socket::INVALID_SOCKET_HANDLE;
-        throw SocketException( __FILE__, __LINE__, ::strerror( errno ));
-   }
-   
-   // Verify the port value.
-   if (port <= 0 || port > 65535) {
-      throw SocketException( __FILE__, __LINE__, 
-         "ServerSocket::bind - Port out of range: %d", port );
-   }
-    
-    
-   sockaddr_in bind_addr;
-   bind_addr.sin_family = AF_INET;
-   bind_addr.sin_port = htons((short)port);
-   bind_addr.sin_addr.s_addr = 0; // To be set later down...
-   memset(&bind_addr.sin_zero, 0, sizeof(bind_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__, ::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);
-   bind_addr.sin_addr.s_addr = ((sockaddr_in*)res_ptr->ai_addr)->sin_addr.s_addr;
-   freeaddrinfo(res_ptr);
-
-   // Set the socket to reuse the address.
-   int value = 1;
-   ::setsockopt(socketHandle, SOL_SOCKET, SO_REUSEADDR, (char*)&value, sizeof(int) );
-      
-   status = ::bind(socketHandle,
-             (sockaddr *)&bind_addr, sizeof(bind_addr));
-
-   if( status < 0 ){
-        close();
-      throw SocketException ( __FILE__, __LINE__, 
-            "ServerSocket::bind - %s", ::strerror( errno ) );
-   }
-   status = ::listen(socketHandle, backlog);
-   if (status < 0) {
-       close();
-       throw SocketException( __FILE__, __LINE__, ::strerror( errno ) );
-   }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ServerSocket::close() throw (cms::CMSException){
-   
-   if (isBound()) {
-        
-      #if (defined(unix) || defined(__APPLE__)) && !defined(__CYGWIN__)
-         ::close(socketHandle);
-      #else
-         ::closesocket(socketHandle);
-      #endif
-
-      socketHandle = Socket::INVALID_SOCKET_HANDLE;
-   }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-bool ServerSocket::isBound() const {
-   return this->socketHandle != Socket::INVALID_SOCKET_HANDLE;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-Socket* ServerSocket::accept () throw (SocketException)
-{
-   struct sockaddr_in temp;
-
-#if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
-   socklen_t temp_len = sizeof (sockaddr_in);
-#else
-   int temp_len = sizeof (sockaddr_in);
-#endif
-
-   SocketHandle ss_socket_handle = 
-      ::accept(socketHandle, (struct sockaddr*)&temp, &temp_len);
-   if (ss_socket_handle < 0) {
-      throw SocketException( __FILE__, __LINE__, 
-         "ServerSocket::accept- %s", ::strerror( errno ) );
-   }
-    
-   return new TcpSocket(ss_socket_handle);
-}
-
+/*
+ * 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
+   #ifdef errno
+   #undef errno
+   #endif
+   int errno;
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <assert.h>
+#include "ServerSocket.h"
+#include <errno.h>
+#include <string>
+
+using namespace activemq::network;
+
+#if !(defined( unix ) || defined(__APPLE__)) || defined( __CYGWIN__ )
+
+   // Static socket initializer needed for winsock
+
+   ServerSocket::StaticServerSocketInitializer::StaticServerSocketInitializer () {
+       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");
+       }
+   }
+   ServerSocket::StaticServerSocketInitializer::~StaticServerSocketInitializer () {
+      clear();
+      WSACleanup();
+   }
+   
+   // Create static instance of the socket initializer.
+   ServerSocket::StaticServerSocketInitializer 
+      ServerSocket::staticSocketInitializer;
+   
+#endif
+
+
+////////////////////////////////////////////////////////////////////////////////
+ServerSocket::ServerSocket()
+{
+   socketHandle = Socket::INVALID_SOCKET_HANDLE;
+   
+#if !(defined( unix ) || defined(__APPLE__)) || defined( __CYGWIN__ )
+   if (ServerSocket::staticSocketInitializer.getSocketInitError() != NULL) {
+      throw *ServerSocket::staticSocketInitializer.getSocketInitError();
+   }
+#endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ServerSocket::~ServerSocket()
+{
+   // No shutdown, just close - dont want blocking destructor.
+   close();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ServerSocket::bind (const char* host, int port) throw (SocketException)
+{
+   bind (host, port, SOMAXCONN);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ServerSocket::bind (const char* host, int port, int backlog) throw (SocketException)
+{
+   if (isBound()) {
+      throw SocketException ( __FILE__, __LINE__, 
+         "ServerSocket::bind - Socket already bound" );
+   }
+    
+    // Create the socket.
+   socketHandle = ::socket(AF_INET, SOCK_STREAM, 0);
+   if (socketHandle < 0) {
+      socketHandle = Socket::INVALID_SOCKET_HANDLE;
+        throw SocketException( __FILE__, __LINE__, ::strerror( errno ));
+   }
+   
+   // Verify the port value.
+   if (port <= 0 || port > 65535) {
+      throw SocketException( __FILE__, __LINE__, 
+         "ServerSocket::bind - Port out of range: %d", port );
+   }
+    
+    
+   sockaddr_in bind_addr;
+   bind_addr.sin_family = AF_INET;
+   bind_addr.sin_port = htons((short)port);
+   bind_addr.sin_addr.s_addr = 0; // To be set later down...
+   memset(&bind_addr.sin_zero, 0, sizeof(bind_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__, ::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);
+   bind_addr.sin_addr.s_addr = ((sockaddr_in*)res_ptr->ai_addr)->sin_addr.s_addr;
+   freeaddrinfo(res_ptr);
+
+   // Set the socket to reuse the address.
+   int value = 1;
+   ::setsockopt(socketHandle, SOL_SOCKET, SO_REUSEADDR, (char*)&value, sizeof(int) );
+      
+   status = ::bind(socketHandle,
+             (sockaddr *)&bind_addr, sizeof(bind_addr));
+
+   if( status < 0 ){
+        close();
+      throw SocketException ( __FILE__, __LINE__, 
+            "ServerSocket::bind - %s", ::strerror( errno ) );
+   }
+   status = ::listen(socketHandle, backlog);
+   if (status < 0) {
+       close();
+       throw SocketException( __FILE__, __LINE__, ::strerror( errno ) );
+   }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ServerSocket::close() throw (cms::CMSException){
+   
+   if (isBound()) {
+        
+      #if (defined(unix) || defined(__APPLE__)) && !defined(__CYGWIN__)
+         ::close(socketHandle);
+      #else
+         ::closesocket(socketHandle);
+      #endif
+
+      socketHandle = Socket::INVALID_SOCKET_HANDLE;
+   }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool ServerSocket::isBound() const {
+   return this->socketHandle != Socket::INVALID_SOCKET_HANDLE;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Socket* ServerSocket::accept () throw (SocketException)
+{
+   struct sockaddr_in temp;
+
+#if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
+   socklen_t temp_len = sizeof (sockaddr_in);
+#else
+   int temp_len = sizeof (sockaddr_in);
+#endif
+
+   SocketHandle ss_socket_handle = 
+      ::accept(socketHandle, (struct sockaddr*)&temp, &temp_len);
+   if (ss_socket_handle < 0) {
+      throw SocketException( __FILE__, __LINE__, 
+         "ServerSocket::accept- %s", ::strerror( errno ) );
+   }
+    
+   return new TcpSocket(ss_socket_handle);
+}
+

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

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/ServerSocket.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/ServerSocket.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/ServerSocket.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/ServerSocket.h Wed Jul  5 15:27:34 2006
@@ -1,119 +1,119 @@
-/*
- * 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_SERVERSOCKETIMPL_H
-#define ACTIVEMQ_NETWORK_SERVERSOCKETIMPL_H
-
-#include <activemq/network/TcpSocket.h>
-#include <activemq/network/SocketException.h>
-
-namespace activemq{
-namespace network{
-
-	/**
-	 * A server socket class (for testing purposes).
-	 */
-	class ServerSocket
-	{
-	public:
-	
-	    typedef Socket::SocketHandle SocketHandle;
-	    
-	private:
-	
-	    SocketHandle socketHandle;
-	    
-	public:
-	
-	    /** 
-	     * Constructor.
-	     * Creates a non-bound server socket.
-	     */
-	    ServerSocket();
-	
-	    /**
-	     * Destructor.
-	     * Releases socket handle if close() hasn't been called.
-	     */
-	    virtual ~ServerSocket();
-	    
-	public:
-	
-	    /**
-	     * Bind and listen to given IP/dns and port.
-	     * @param host IP address or host name.
-	     * @param port TCP port between 1..655535
-	     */
-	    virtual void bind (const char* host, int port) throw (SocketException);
-	
-	    /**
-	     * Bind and listen to given IP/dns and port.
-	     * @param host IP address or host name.
-	     * @param port TCP port between 1..655535
-	     * @param backlog Size of listen backlog.
-	     */
-	    virtual void bind (const char* host, int port, int backlog) throw (SocketException);
-	
-	    /**
-	     * Blocks until a client connects to the bound socket.
-	     * @return new socket. Never returns NULL.
-	     */
-	    virtual Socket* accept () throw (SocketException);
-	
-	    /**
-	     * Closes the server socket.
-	     */
-	    virtual void close() throw(cms::CMSException);
-	
-	    /**
-	     * @return true of the server socket is bound.
-	     */ 
-	    virtual bool isBound() const;
-       
-   protected:
-
-      #if !defined( unix ) || defined( __CYGWIN__ )
-      
-          // WINDOWS needs initialization of winsock
-          class StaticServerSocketInitializer {
-          private:
-          
-              SocketException* socketInitError;
-              
-              void clear(){
-               if( socketInitError != NULL ){
-                  delete socketInitError;
-               }
-               socketInitError = NULL;
-              }
-              
-          public:
-              SocketException* getSocketInitError () {
-                  return socketInitError;
-              }
-              StaticServerSocketInitializer();
-              virtual ~StaticServerSocketInitializer ();
-                      
-          };
-          static StaticServerSocketInitializer staticSocketInitializer;
-      #endif
-      
-   };
-
-}}
-
-#endif // ACTIVEMQ_NETWORK_SERVERSOCKETIMPL_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_SERVERSOCKETIMPL_H
+#define ACTIVEMQ_NETWORK_SERVERSOCKETIMPL_H
+
+#include <activemq/network/TcpSocket.h>
+#include <activemq/network/SocketException.h>
+
+namespace activemq{
+namespace network{
+
+	/**
+	 * A server socket class (for testing purposes).
+	 */
+	class ServerSocket
+	{
+	public:
+	
+	    typedef Socket::SocketHandle SocketHandle;
+	    
+	private:
+	
+	    SocketHandle socketHandle;
+	    
+	public:
+	
+	    /** 
+	     * Constructor.
+	     * Creates a non-bound server socket.
+	     */
+	    ServerSocket();
+	
+	    /**
+	     * Destructor.
+	     * Releases socket handle if close() hasn't been called.
+	     */
+	    virtual ~ServerSocket();
+	    
+	public:
+	
+	    /**
+	     * Bind and listen to given IP/dns and port.
+	     * @param host IP address or host name.
+	     * @param port TCP port between 1..655535
+	     */
+	    virtual void bind (const char* host, int port) throw (SocketException);
+	
+	    /**
+	     * Bind and listen to given IP/dns and port.
+	     * @param host IP address or host name.
+	     * @param port TCP port between 1..655535
+	     * @param backlog Size of listen backlog.
+	     */
+	    virtual void bind (const char* host, int port, int backlog) throw (SocketException);
+	
+	    /**
+	     * Blocks until a client connects to the bound socket.
+	     * @return new socket. Never returns NULL.
+	     */
+	    virtual Socket* accept () throw (SocketException);
+	
+	    /**
+	     * Closes the server socket.
+	     */
+	    virtual void close() throw(cms::CMSException);
+	
+	    /**
+	     * @return true of the server socket is bound.
+	     */ 
+	    virtual bool isBound() const;
+       
+   protected:
+
+      #if !defined( unix ) || defined( __CYGWIN__ )
+      
+          // WINDOWS needs initialization of winsock
+          class StaticServerSocketInitializer {
+          private:
+          
+              SocketException* socketInitError;
+              
+              void clear(){
+               if( socketInitError != NULL ){
+                  delete socketInitError;
+               }
+               socketInitError = NULL;
+              }
+              
+          public:
+              SocketException* getSocketInitError () {
+                  return socketInitError;
+              }
+              StaticServerSocketInitializer();
+              virtual ~StaticServerSocketInitializer ();
+                      
+          };
+          static StaticServerSocketInitializer staticSocketInitializer;
+      #endif
+      
+   };
+
+}}
+
+#endif // ACTIVEMQ_NETWORK_SERVERSOCKETIMPL_H
+

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

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/Socket.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/Socket.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/Socket.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/Socket.h Wed Jul  5 15:27:34 2006
@@ -1,170 +1,170 @@
-/*
- * 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/io/InputStream.h>
-#include <activemq/io/OutputStream.h>
-#include <cms/Closeable.h>
-
-#if !(defined( unix ) || defined(__APPLE__)) || defined( __CYGWIN__ )
-#include <Winsock2.h> // SOCKET
-#endif
-
-namespace activemq{
-namespace network{
-
-   class Socket : public cms::Closeable
-   {
-   public:
-   
-      // Define the SocketHandle type.
-      #if defined( unix ) || defined(__APPLE__) && !defined( __CYGWIN__ )
-          typedef int SocketHandle;
-      #else
-          typedef SOCKET SocketHandle;
-      #endif
-
-      /**
-       * Defines a constant for an invalid socket handle.
-       */   
-       static const SocketHandle INVALID_SOCKET_HANDLE = (SocketHandle) -1;
-
-   public:
-
-      /**
-       * Destructor
-       */
-   	virtual ~Socket(void) {}
-
-       /**
-       * 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) = 0;
-      
-      /**
-       * Indicates whether or not this socket is connected to a destination.
-       */
-      virtual bool isConnected() const = 0;      
-
-      /**
-       * Gets the InputStream for this socket.
-       * @return The InputStream for this socket. NULL if not connected.
-       */
-      virtual io::InputStream* getInputStream() = 0;
-      
-      /**
-       * Gets the OutputStream for this socket.
-       * @return the OutputStream for this socket.  NULL if not connected.
-       */
-      virtual io::OutputStream* getOutputStream() = 0;
-
-      /**
-       * Gets the linger time.
-       * @return The linger time in seconds.
-       * @throws SocketException if the operation fails.
-       */
-      virtual int getSoLinger() const throw(SocketException) = 0;
-      
-      /**
-       * 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) = 0;
-      
-      /**
-       * Gets the keep alive flag.
-       * @return True if keep alive is enabled.
-       * @throws SocketException if the operation fails.
-       */
-      virtual bool getKeepAlive() const throw(SocketException) = 0;
-      
-      /**
-       * 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) = 0;
-      
-      /**
-       * Gets the receive buffer size.
-       * @return the receive buffer size in bytes.
-       * @throws SocketException if the operation fails.
-       */
-      virtual int getReceiveBufferSize() const throw(SocketException) = 0;
-      
-      /**
-       * 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) = 0;
-      
-      /**
-       * 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) = 0;
-      
-      /**
-       * 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) = 0;
-      
-      /**
-       * 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) = 0;
-      
-      /**
-       * 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) = 0;
-      
-      /**
-       * 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) = 0;
-      
-      /**
-       * 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) = 0;
-
-   };
-
-}}
-
-#endif /*_ACTIVEMQ_NETWORK_BASESOCKET_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/io/InputStream.h>
+#include <activemq/io/OutputStream.h>
+#include <cms/Closeable.h>
+
+#if !(defined( unix ) || defined(__APPLE__)) || defined( __CYGWIN__ )
+#include <Winsock2.h> // SOCKET
+#endif
+
+namespace activemq{
+namespace network{
+
+   class Socket : public cms::Closeable
+   {
+   public:
+   
+      // Define the SocketHandle type.
+      #if defined( unix ) || defined(__APPLE__) && !defined( __CYGWIN__ )
+          typedef int SocketHandle;
+      #else
+          typedef SOCKET SocketHandle;
+      #endif
+
+      /**
+       * Defines a constant for an invalid socket handle.
+       */   
+       static const SocketHandle INVALID_SOCKET_HANDLE = (SocketHandle) -1;
+
+   public:
+
+      /**
+       * Destructor
+       */
+   	virtual ~Socket(void) {}
+
+       /**
+       * 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) = 0;
+      
+      /**
+       * Indicates whether or not this socket is connected to a destination.
+       */
+      virtual bool isConnected() const = 0;      
+
+      /**
+       * Gets the InputStream for this socket.
+       * @return The InputStream for this socket. NULL if not connected.
+       */
+      virtual io::InputStream* getInputStream() = 0;
+      
+      /**
+       * Gets the OutputStream for this socket.
+       * @return the OutputStream for this socket.  NULL if not connected.
+       */
+      virtual io::OutputStream* getOutputStream() = 0;
+
+      /**
+       * Gets the linger time.
+       * @return The linger time in seconds.
+       * @throws SocketException if the operation fails.
+       */
+      virtual int getSoLinger() const throw(SocketException) = 0;
+      
+      /**
+       * 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) = 0;
+      
+      /**
+       * Gets the keep alive flag.
+       * @return True if keep alive is enabled.
+       * @throws SocketException if the operation fails.
+       */
+      virtual bool getKeepAlive() const throw(SocketException) = 0;
+      
+      /**
+       * 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) = 0;
+      
+      /**
+       * Gets the receive buffer size.
+       * @return the receive buffer size in bytes.
+       * @throws SocketException if the operation fails.
+       */
+      virtual int getReceiveBufferSize() const throw(SocketException) = 0;
+      
+      /**
+       * 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) = 0;
+      
+      /**
+       * 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) = 0;
+      
+      /**
+       * 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) = 0;
+      
+      /**
+       * 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) = 0;
+      
+      /**
+       * 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) = 0;
+      
+      /**
+       * 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) = 0;
+      
+      /**
+       * 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) = 0;
+
+   };
+
+}}
+
+#endif /*_ACTIVEMQ_NETWORK_BASESOCKET_H_*/

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

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketException.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketException.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketException.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketException.h Wed Jul  5 15:27:34 2006
@@ -1,66 +1,66 @@
-/*
- * 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_SOCKETEXCEPTION_H
-#define ACTIVEMQ_NETWORK_SOCKETEXCEPTION_H
-
-#include <activemq/io/IOException.h>
-
-namespace activemq{
-namespace network{
-
-	/**
-	 * Exception for errors when manipulating sockets.
-	 */
-	class SocketException : public io::IOException
-	{
-	public:
-	
-		SocketException(){}
-        SocketException( const ActiveMQException& ex ){
-            *(ActiveMQException*)this = ex;
-        }
-        SocketException( const SocketException& ex ){
-            *(ActiveMQException*)this = ex;
-        }
-	    SocketException(const char* file, const int lineNumber, 
-            const char* msg, ...)
-	    {
-	        va_list vargs ;
-            va_start(vargs, msg) ;
-            buildMessage(msg, vargs) ;
-            
-            // Set the first mark for this exception.
-            setMark( file, lineNumber );
-	    }
-        
-        /**
-         * Clones this exception.  This is useful for cases where you need
-         * to preserve the type of the original exception as well as the message.
-         * All subclasses should override.
-         */
-        virtual ActiveMQException* clone() const{
-            return new SocketException( *this );
-        }
-        
-	    virtual ~SocketException(){}
-	} ;
-
-}}
-
-
-#endif // ACTIVEMQ_NETWORK_SOCKETEXCEPTION_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_SOCKETEXCEPTION_H
+#define ACTIVEMQ_NETWORK_SOCKETEXCEPTION_H
+
+#include <activemq/io/IOException.h>
+
+namespace activemq{
+namespace network{
+
+	/**
+	 * Exception for errors when manipulating sockets.
+	 */
+	class SocketException : public io::IOException
+	{
+	public:
+	
+		SocketException(){}
+        SocketException( const ActiveMQException& ex ){
+            *(ActiveMQException*)this = ex;
+        }
+        SocketException( const SocketException& ex ){
+            *(ActiveMQException*)this = ex;
+        }
+	    SocketException(const char* file, const int lineNumber, 
+            const char* msg, ...)
+	    {
+	        va_list vargs ;
+            va_start(vargs, msg) ;
+            buildMessage(msg, vargs) ;
+            
+            // Set the first mark for this exception.
+            setMark( file, lineNumber );
+	    }
+        
+        /**
+         * Clones this exception.  This is useful for cases where you need
+         * to preserve the type of the original exception as well as the message.
+         * All subclasses should override.
+         */
+        virtual ActiveMQException* clone() const{
+            return new SocketException( *this );
+        }
+        
+	    virtual ~SocketException(){}
+	} ;
+
+}}
+
+
+#endif // ACTIVEMQ_NETWORK_SOCKETEXCEPTION_H
+

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

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketFactory.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketFactory.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketFactory.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketFactory.cpp Wed Jul  5 15:27:34 2006
@@ -1,117 +1,117 @@
-/*
- * 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 <activemq/network/SocketFactory.h>
-#include <activemq/network/BufferedSocket.h>
-#include <activemq/network/TcpSocket.h>
-#include <activemq/util/Properties.h>
-
-using namespace std;
-using namespace activemq;
-using namespace activemq::util;
-using namespace activemq::network;
-using namespace activemq::exceptions;
-
-////////////////////////////////////////////////////////////////////////////////
-Socket* SocketFactory::createSocket(const Properties& properties)
-   throw ( SocketException )
-{
-   try
-   {
-      const char* uri = properties.getProperty( "uri" );
-      if( uri == NULL )
-      {
-         throw SocketException( __FILE__, __LINE__, 
-               "SocketTransport::start() - uri not provided" );
-      }
-
-      string dummy = uri;
-      
-      // Extract the port.
-      unsigned int portIx = dummy.find( ':' );
-      if( portIx == string::npos )
-      {
-         throw SocketException( __FILE__, __LINE__, 
-            "SocketTransport::start() - uri malformed - port not specified: %s", uri);
-      }
-      string host = dummy.substr( 0, portIx );
-      string portString = dummy.substr( portIx + 1 );
-      int port;
-      if( sscanf( portString.c_str(), "%d", &port) != 1 )
-      {
-         throw SocketException( __FILE__, __LINE__, 
-            "SocketTransport::start() - unable to extract port from uri: %s", uri);
-      }
-      
-      // Get the read buffer size.
-      int inputBufferSize = 10000;
-      dummy = properties.getProperty( "inputBufferSize", "10000" );  
-      sscanf( dummy.c_str(), "%d", &inputBufferSize );
-      
-      // Get the write buffer size.
-      int outputBufferSize = 10000;
-      dummy = properties.getProperty( "outputBufferSize", "10000" ); 
-      sscanf( dummy.c_str(), "%d", &outputBufferSize );
-      
-      // Get the linger flag.
-      int soLinger = 0;
-      dummy = properties.getProperty( "soLinger", "0" ); 
-      sscanf( dummy.c_str(), "%d", &soLinger ); 
-      
-      // Get the keepAlive flag.
-      bool soKeepAlive = 
-         properties.getProperty( "soKeepAlive", "false" ) == "true";   
-      
-      // Get the socket receive buffer size.
-      int soReceiveBufferSize = 2000000;
-      dummy = properties.getProperty( "soReceiveBufferSize", "2000000" );  
-      sscanf( dummy.c_str(), "%d", &soReceiveBufferSize );
-      
-      // Get the socket send buffer size.
-      int soSendBufferSize = 2000000;
-      dummy = properties.getProperty( "soSendBufferSize", "2000000" );  
-      sscanf( dummy.c_str(), "%d", &soSendBufferSize );
-      
-      // Get the socket send buffer size.
-      int soTimeout = 10000;
-      dummy = properties.getProperty( "soTimeout", "10000" );  
-      sscanf( dummy.c_str(), "%d", &soTimeout );
-      
-      // Now that we have all the elements that we wanted - let's do it!
-      // Create a TCP Socket and then Wrap it in a buffered socket
-      // so that users get the benefit of buffered reads and writes.
-      // The buffered socket will own the TcpSocket instance, and will
-      // clean it up when it is cleaned up.
-      TcpSocket* tcpSocket = new TcpSocket();
-      BufferedSocket* socket = 
-         new BufferedSocket(tcpSocket, inputBufferSize, outputBufferSize);
-      
-      // Connect the socket.
-      socket->connect( host.c_str(), port );
-      
-      // Set the socket options.
-      socket->setSoLinger( soLinger );
-      socket->setKeepAlive( soKeepAlive );
-      socket->setReceiveBufferSize( soReceiveBufferSize );
-      socket->setSendBufferSize( soSendBufferSize );
-      socket->setSoTimeout( soTimeout );
-
-      return socket;
-   }
-   AMQ_CATCH_RETHROW( SocketException )
-   AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, SocketException )
-   AMQ_CATCHALL_THROW( SocketException )   
-}
+/*
+ * 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 <activemq/network/SocketFactory.h>
+#include <activemq/network/BufferedSocket.h>
+#include <activemq/network/TcpSocket.h>
+#include <activemq/util/Properties.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::util;
+using namespace activemq::network;
+using namespace activemq::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+Socket* SocketFactory::createSocket(const Properties& properties)
+   throw ( SocketException )
+{
+   try
+   {
+      const char* uri = properties.getProperty( "uri" );
+      if( uri == NULL )
+      {
+         throw SocketException( __FILE__, __LINE__, 
+               "SocketTransport::start() - uri not provided" );
+      }
+
+      string dummy = uri;
+      
+      // Extract the port.
+      unsigned int portIx = dummy.find( ':' );
+      if( portIx == string::npos )
+      {
+         throw SocketException( __FILE__, __LINE__, 
+            "SocketTransport::start() - uri malformed - port not specified: %s", uri);
+      }
+      string host = dummy.substr( 0, portIx );
+      string portString = dummy.substr( portIx + 1 );
+      int port;
+      if( sscanf( portString.c_str(), "%d", &port) != 1 )
+      {
+         throw SocketException( __FILE__, __LINE__, 
+            "SocketTransport::start() - unable to extract port from uri: %s", uri);
+      }
+      
+      // Get the read buffer size.
+      int inputBufferSize = 10000;
+      dummy = properties.getProperty( "inputBufferSize", "10000" );  
+      sscanf( dummy.c_str(), "%d", &inputBufferSize );
+      
+      // Get the write buffer size.
+      int outputBufferSize = 10000;
+      dummy = properties.getProperty( "outputBufferSize", "10000" ); 
+      sscanf( dummy.c_str(), "%d", &outputBufferSize );
+      
+      // Get the linger flag.
+      int soLinger = 0;
+      dummy = properties.getProperty( "soLinger", "0" ); 
+      sscanf( dummy.c_str(), "%d", &soLinger ); 
+      
+      // Get the keepAlive flag.
+      bool soKeepAlive = 
+         properties.getProperty( "soKeepAlive", "false" ) == "true";   
+      
+      // Get the socket receive buffer size.
+      int soReceiveBufferSize = 2000000;
+      dummy = properties.getProperty( "soReceiveBufferSize", "2000000" );  
+      sscanf( dummy.c_str(), "%d", &soReceiveBufferSize );
+      
+      // Get the socket send buffer size.
+      int soSendBufferSize = 2000000;
+      dummy = properties.getProperty( "soSendBufferSize", "2000000" );  
+      sscanf( dummy.c_str(), "%d", &soSendBufferSize );
+      
+      // Get the socket send buffer size.
+      int soTimeout = 10000;
+      dummy = properties.getProperty( "soTimeout", "10000" );  
+      sscanf( dummy.c_str(), "%d", &soTimeout );
+      
+      // Now that we have all the elements that we wanted - let's do it!
+      // Create a TCP Socket and then Wrap it in a buffered socket
+      // so that users get the benefit of buffered reads and writes.
+      // The buffered socket will own the TcpSocket instance, and will
+      // clean it up when it is cleaned up.
+      TcpSocket* tcpSocket = new TcpSocket();
+      BufferedSocket* socket = 
+         new BufferedSocket(tcpSocket, inputBufferSize, outputBufferSize);
+      
+      // Connect the socket.
+      socket->connect( host.c_str(), port );
+      
+      // Set the socket options.
+      socket->setSoLinger( soLinger );
+      socket->setKeepAlive( soKeepAlive );
+      socket->setReceiveBufferSize( soReceiveBufferSize );
+      socket->setSendBufferSize( soSendBufferSize );
+      socket->setSoTimeout( soTimeout );
+
+      return socket;
+   }
+   AMQ_CATCH_RETHROW( SocketException )
+   AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, SocketException )
+   AMQ_CATCHALL_THROW( SocketException )   
+}

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

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketFactory.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketFactory.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketFactory.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketFactory.h Wed Jul  5 15:27:34 2006
@@ -1,68 +1,68 @@
-/*
- * 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_SOCKETFACTORY_H_
-#define _ACTIVEMQ_NETWORK_SOCKETFACTORY_H_
-
-#include <activemq/network/SocketException.h>
-#include <activemq/util/Properties.h>
-
-namespace activemq{
-namespace network{
-
-   class Socket;
-   
-   /**
-    * Socket Factory implementation for use in Creating Sockets
-    * <p>
-    * <p>
-    * Property Options: <p>
-    * Name                  Value <p>
-    * ------------------------------------- <p>
-    * uri                   The uri for the transport connection. Must be provided.<p>
-    * inputBufferSize       size in bytes of the buffered input stream buffer.  Defaults to 10000.<p>
-    * outputBufferSize      size in bytes of the buffered output stream buffer. Defaults to 10000.<p>
-    * soLinger              linger time for the socket (in microseconds). Defaults to 0.<p>
-    * soKeepAlive           keep alive flag for the socket (true/false). Defaults to false.<p>
-    * soReceiveBufferSize   The size of the socket receive buffer (in bytes). Defaults to 2MB.<p>
-    * soSendBufferSize      The size of the socket send buffer (in bytes). Defaults to 2MB.<p>
-    * soTimeout             The timeout of socket IO operations (in microseconds). Defaults to 10000<p>
-    * 
-    * @see <code>Socket</code>
-    */
-   class SocketFactory
-   {
-   public:
-
-      /**
-       * Destructor
-       */
-   	virtual ~SocketFactory();
-      
-      /**
-       * Creates and returns a Socket dervied Object based on the values
-       * defined in the Properties Object that is passed in.
-       * @param a IProperties pointer.
-       * @throws SocketException.
-       */
-      static Socket* createSocket(const util::Properties& properties)
-         throw ( SocketException );
-         
-   };
-
-}}
-
-#endif /*_ACTIVEMQ_NETWORK_SOCKETFACTORY_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_SOCKETFACTORY_H_
+#define _ACTIVEMQ_NETWORK_SOCKETFACTORY_H_
+
+#include <activemq/network/SocketException.h>
+#include <activemq/util/Properties.h>
+
+namespace activemq{
+namespace network{
+
+   class Socket;
+   
+   /**
+    * Socket Factory implementation for use in Creating Sockets
+    * <p>
+    * <p>
+    * Property Options: <p>
+    * Name                  Value <p>
+    * ------------------------------------- <p>
+    * uri                   The uri for the transport connection. Must be provided.<p>
+    * inputBufferSize       size in bytes of the buffered input stream buffer.  Defaults to 10000.<p>
+    * outputBufferSize      size in bytes of the buffered output stream buffer. Defaults to 10000.<p>
+    * soLinger              linger time for the socket (in microseconds). Defaults to 0.<p>
+    * soKeepAlive           keep alive flag for the socket (true/false). Defaults to false.<p>
+    * soReceiveBufferSize   The size of the socket receive buffer (in bytes). Defaults to 2MB.<p>
+    * soSendBufferSize      The size of the socket send buffer (in bytes). Defaults to 2MB.<p>
+    * soTimeout             The timeout of socket IO operations (in microseconds). Defaults to 10000<p>
+    * 
+    * @see <code>Socket</code>
+    */
+   class SocketFactory
+   {
+   public:
+
+      /**
+       * Destructor
+       */
+   	virtual ~SocketFactory();
+      
+      /**
+       * Creates and returns a Socket dervied Object based on the values
+       * defined in the Properties Object that is passed in.
+       * @param a IProperties pointer.
+       * @throws SocketException.
+       */
+      static Socket* createSocket(const util::Properties& properties)
+         throw ( SocketException );
+         
+   };
+
+}}
+
+#endif /*_ACTIVEMQ_NETWORK_SOCKETFACTORY_H_*/

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