activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r465222 - /incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs
Date Wed, 18 Oct 2006 11:39:38 GMT
Author: jstrachan
Date: Wed Oct 18 04:39:38 2006
New Revision: 465222

URL: http://svn.apache.org/viewvc?view=rev&rev=465222
Log:
applied patch for AMQ-985

Modified:
    incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs

Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs?view=diff&rev=465222&r1=465221&r2=465222
==============================================================================
--- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs
(original)
+++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs
Wed Oct 18 04:39:38 2006
@@ -23,46 +23,50 @@
 using ActiveMQ.Transport;
 
 namespace ActiveMQ.Transport.Tcp {
-    public class TcpTransportFactory : ITransportFactory {
-        private bool useLogging = false;
+        public class TcpTransportFactory : ITransportFactory
+        {
+                private bool useLogging = false;
 
-        public bool UseLogging 
-		{
-            get { return useLogging; } 
-            set { useLogging = value; } 
-        }
+                public bool UseLogging {
+                        get { return useLogging; } 
+                        set { useLogging = value; } 
+                }
 
-        public ITransport CreateTransport(Uri location) 
-		{
-            // Console.WriteLine("Opening socket to: " + host + " on port: " + port);
-            Socket socket = Connect(location.Host, location.Port);
-            TcpTransport tcpTransport = new TcpTransport(socket);
-            ITransport rc = tcpTransport;
-
-            rc = new WireFormatNegotiator(rc, tcpTransport.Wireformat);
-            
-            // At present the URI is parsed for options by the ConnectionFactory
-			if (UseLogging) {
-                rc = new LoggingTransport(rc);
-            }
-            rc = new ResponseCorrelator(rc);
-            rc = new MutexTransport(rc);
+                public ITransport CreateTransport(Uri location)
+                {
+                        // Console.WriteLine("Opening socket to: " + host + " on port: "
+ port);
+                        Socket socket = Connect(location.Host, location.Port);
+                        TcpTransport tcpTransport = new TcpTransport(socket);
+                        ITransport rc = tcpTransport;
 
-            return rc;
-        }
+                        // At present the URI is parsed for options by the ConnectionFactory
+                        if (UseLogging)
+                        {
+                                rc = new LoggingTransport(rc);
+                        }
+
+                        rc = new WireFormatNegotiator(rc, tcpTransport.Wireformat);
+                        rc = new ResponseCorrelator(rc);
+                        rc = new MutexTransport(rc);
+
+                        return rc;
+                }
 
-        protected Socket Connect(string host, int port) {
-            // Looping through the AddressList allows different type of connections to be
tried
-            // (IPv4, IPv6 and whatever else may be available).
-            IPHostEntry hostEntry = Dns.Resolve(host);
-            foreach (IPAddress address in hostEntry.AddressList) {
-                Socket socket = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
-                socket.Connect(new IPEndPoint(address, port));
-                if (socket.Connected) {
-                    return socket;
+                protected Socket Connect(string host, int port)
+                {
+                        // Looping through the AddressList allows different type of connections
to be tried
+                        // (IPv4, IPv6 and whatever else may be available).
+                        IPHostEntry hostEntry = Dns.Resolve(host);
+                        foreach (IPAddress address in hostEntry.AddressList)
+                        {
+                                Socket socket = new Socket(address.AddressFamily, SocketType.Stream,
ProtocolType.Tcp);
+                                socket.Connect(new IPEndPoint(address, port));
+                                if (socket.Connected)
+                                {
+                                        return socket;
+                                }
+                        }
+                        throw new SocketException();
                 }
-            }
-            throw new SocketException();
         }
-    }
 }



Mime
View raw message