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); }
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); } }
public TlsTransportListener(ConnectionListener listener, string host, int port, X509Certificate2 certificate) : base(listener, host, port) { this.certificate = certificate; }
public ListenerSaslProfile(ConnectionListener listener) : base(string.Empty) { this.listener = listener; }
public ListenerSaslProfile(ConnectionListener listener) { this.listener = listener; }
internal ListenerConnection(ConnectionListener listener, Address address, IAsyncTransport transport) : base(listener, address, transport, null, null) { this.listener = listener; }
internal ListenerConnection(ConnectionListener listener, Address address, IAsyncTransport transport) : base(listener.BufferManager, listener.AMQP, address, transport, null, onOpened) { this.listener = listener; }
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); }
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); } }
public CustomTransportListener(ConnectionListener listener, TransportProvider provider) { this.Listener = listener; this.provider = provider; }
public void ConnectionListenerCloseWithoutOpenTest() { ConnectionListener listener = new ConnectionListener("amqp://localhost:12345", null); listener.Close(); }
internal ListenerConnection(ConnectionListener listener, Address address, IAsyncTransport transport) : base(listener.AMQP, address, transport, null, null) { this.listener = listener; }