/// <summary> /// Open a socket file descriptor. /// The callback configures endpoint-specific settings. /// </summary> public void ListenHandle(ulong handle, Action <ListenOptions> configure) { if (configure == null) { throw new ArgumentNullException(nameof(configure)); } var listenOptions = new ListenOptions(handle); ApplyEndpointDefaults(listenOptions); configure(listenOptions); CodeBackedListenOptions.Add(listenOptions); }
/// <summary> /// Listens on all IPs using IPv6 [::], or IPv4 0.0.0.0 if IPv6 is not supported. /// </summary> public void ListenAnyIP(int port, Action <ListenOptions> configure) { if (configure == null) { throw new ArgumentNullException(nameof(configure)); } var listenOptions = new AnyIPListenOptions(port); ApplyEndpointDefaults(listenOptions); configure(listenOptions); CodeBackedListenOptions.Add(listenOptions); }
/// <summary> /// Bind to the given endpoint. /// The callback configures endpoint-specific settings. /// </summary> public void Listen(EndPoint endPoint, Action <ListenOptions> configure) { if (endPoint == null) { throw new ArgumentNullException(nameof(endPoint)); } if (configure == null) { throw new ArgumentNullException(nameof(configure)); } var listenOptions = new ListenOptions(endPoint); ApplyEndpointDefaults(listenOptions); configure(listenOptions); CodeBackedListenOptions.Add(listenOptions); }
/// <summary> /// Bind to given Unix domain socket path. /// Specify callback to configure endpoint-specific settings. /// </summary> public void ListenUnixSocket(string socketPath, Action <ListenOptions> configure) { if (socketPath == null) { throw new ArgumentNullException(nameof(socketPath)); } if (!Path.IsPathRooted(socketPath)) { throw new ArgumentException(CoreStrings.UnixSocketPathMustBeAbsolute, nameof(socketPath)); } if (configure == null) { throw new ArgumentNullException(nameof(configure)); } var listenOptions = new ListenOptions(socketPath); ApplyEndpointDefaults(listenOptions); configure(listenOptions); CodeBackedListenOptions.Add(listenOptions); }