The conneciton listener accepts AMQP connections from an address.
Наследование: ConnectionFactoryBase
Пример #1
0
            public WebSocketTransportListener(ConnectionListener listener, string scheme, string host, int port, string path)
            {
                this.listener = listener;

                // if certificate is set, it must be bound to host:port by netsh http command
                string address = string.Format("{0}://{1}:{2}{3}", scheme, host, port, path);

                this.httpListener = new HttpListener();
                this.httpListener.Prefixes.Add(address);
            }
Пример #2
0
            public TcpTransportListener(ConnectionListener listener, string host, int port)
            {
                this.Listener = listener;

                List <IPAddress> addresses = new List <IPAddress>();
                IPAddress        ipAddress;

                if (IPAddress.TryParse(host, out ipAddress))
                {
                    addresses.Add(ipAddress);
                }
                else if (host.Equals("localhost", StringComparison.OrdinalIgnoreCase) ||
                         host.Equals(Environment.GetEnvironmentVariable("COMPUTERNAME"), StringComparison.OrdinalIgnoreCase) ||
                         host.Equals(Amqp.TaskExtensions.GetHostEntryAsync(string.Empty).Result.HostName, StringComparison.OrdinalIgnoreCase))
                {
                    if (Socket.OSSupportsIPv4)
                    {
                        addresses.Add(IPAddress.Any);
                    }

                    if (Socket.OSSupportsIPv6)
                    {
                        addresses.Add(IPAddress.IPv6Any);
                    }
                }
                else
                {
                    addresses.AddRange(Amqp.TaskExtensions.GetHostAddressesAsync(host).GetAwaiter().GetResult());
                }

                this.listenSockets = new Socket[addresses.Count];
                for (int i = 0; i < addresses.Count; ++i)
                {
                    this.listenSockets[i] = new Socket(addresses[i].AddressFamily, SocketType.Stream, ProtocolType.Tcp)
                    {
                        NoDelay = true
                    };
                    this.listenSockets[i].SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
                    this.listenSockets[i].Bind(new IPEndPoint(addresses[i], port));
                    this.listenSockets[i].Listen(20);
                }
            }
            public TcpTransportListener(ConnectionListener listener, string host, int port)
            {
                this.Listener = listener;

                List <IPAddress> addresses = new List <IPAddress>();
                IPAddress        ipAddress;

                if (host.Equals("localhost", StringComparison.OrdinalIgnoreCase) ||
                    host.Equals(Environment.MachineName, StringComparison.OrdinalIgnoreCase) ||
                    host.Equals(Dns.GetHostEntry(string.Empty).HostName, StringComparison.OrdinalIgnoreCase))
                {
                    if (Socket.OSSupportsIPv4)
                    {
                        addresses.Add(IPAddress.Any);
                    }

                    if (Socket.OSSupportsIPv6)
                    {
                        addresses.Add(IPAddress.IPv6Any);
                    }
                }
                else if (IPAddress.TryParse(host, out ipAddress))
                {
                    addresses.Add(ipAddress);
                }
                else
                {
                    addresses.AddRange(Dns.GetHostAddresses(host));
                }

                this.listenSockets = new Socket[addresses.Count];
                for (int i = 0; i < addresses.Count; ++i)
                {
                    this.listenSockets[i] = new Socket(addresses[i].AddressFamily, SocketType.Stream, ProtocolType.Tcp)
                    {
                        NoDelay = true
                    };
                    this.listenSockets[i].Bind(new IPEndPoint(addresses[i], port));
                    this.listenSockets[i].Listen(20);
                }
            }
Пример #4
0
 public TlsTransportListener(ConnectionListener listener, string host, int port, X509Certificate2 certificate)
     : base(listener, host, port)
 {
     this.certificate = certificate;
 }
Пример #5
0
 public ListenerSaslProfile(ConnectionListener listener)
     : base(string.Empty)
 {
     this.listener = listener;
 }
Пример #6
0
 public ListenerSaslProfile(ConnectionListener listener)
 {
     this.listener = listener;
 }
Пример #7
0
 internal ListenerConnection(ConnectionListener listener, Address address, IAsyncTransport transport)
     : base(listener, address, transport, null, null)
 {
     this.listener = listener;
 }
Пример #8
0
 internal ListenerConnection(ConnectionListener listener, Address address, IAsyncTransport transport)
     : base(listener.BufferManager, listener.AMQP, address, transport, null, onOpened)
 {
     this.listener = listener;
 }
Пример #9
0
 internal ListenerConnection(ConnectionListener listener, Address address, IAsyncTransport transport)
     : base(listener.BufferManager, listener.AMQP, address, transport, null, onOpened)
 {
     this.listener = listener;
 }
Пример #10
0
            public WebSocketTransportListener(ConnectionListener listener, string host, int port, string path, X509Certificate2 certificate)
            {
                this.listener = listener;

                // if certificate is set, it must be bound to host:port by netsh http command
                string address = string.Format("{0}://{1}:{2}{3}", certificate == null ? "http" : "https", host, port, path);
                this.httpListener = new HttpListener();
                this.httpListener.Prefixes.Add(address);
            }
Пример #11
0
 public TlsTransportListener(ConnectionListener listener, string host, int port, X509Certificate2 certificate)
     : base(listener, host, port)
 {
     this.certificate = certificate;
 }
Пример #12
0
            public TcpTransportListener(ConnectionListener listener, string host, int port)
            {
                this.Listener = listener;

                List<IPAddress> addresses = new List<IPAddress>();
                IPAddress ipAddress;
                if (host.Equals("localhost", StringComparison.OrdinalIgnoreCase) ||
                    host.Equals(Environment.MachineName, StringComparison.OrdinalIgnoreCase) ||
                    host.Equals(Dns.GetHostEntry(string.Empty).HostName, StringComparison.OrdinalIgnoreCase))
                {
                    if (Socket.OSSupportsIPv4)
                    {
                        addresses.Add(IPAddress.Any);
                    }

                    if (Socket.OSSupportsIPv6)
                    {
                        addresses.Add(IPAddress.IPv6Any);
                    }
                }
                else if (IPAddress.TryParse(host, out ipAddress))
                {
                    addresses.Add(ipAddress);
                }
                else
                {
                    addresses.AddRange(Dns.GetHostAddresses(host));
                }

                this.listenSockets = new Socket[addresses.Count];
                for (int i = 0; i < addresses.Count; ++i)
                {
                    this.listenSockets[i] = new Socket(addresses[i].AddressFamily, SocketType.Stream, ProtocolType.Tcp) { NoDelay = true };
                    this.listenSockets[i].Bind(new IPEndPoint(addresses[i], port));
                    this.listenSockets[i].Listen(20);
                }
            }
Пример #13
0
 public ListenerSaslProfile(ConnectionListener listener)
 {
     this.listener = listener;
 }
Пример #14
0
 public CustomTransportListener(ConnectionListener listener, TransportProvider provider)
 {
     this.Listener = listener;
     this.provider = provider;
 }
Пример #15
0
 public CustomTransportListener(ConnectionListener listener, TransportProvider provider)
 {
     this.Listener = listener;
     this.provider = provider;
 }
Пример #16
0
 public void ConnectionListenerCloseWithoutOpenTest()
 {
     ConnectionListener listener = new ConnectionListener("amqp://localhost:12345", null);
     listener.Close();
 }
Пример #17
0
 internal ListenerConnection(ConnectionListener listener, Address address, IAsyncTransport transport)
     : base(listener.AMQP, address, transport, null, null)
 {
     this.listener = listener;
 }