Ejemplo n.º 1
0
        /// <summary>
        /// Starts the server.
        /// </summary>
        /// <returns>A task that will complete when the server has started.</returns>
        public async Task StartAsync()
        {
            HConsole.WriteLine(this, $"Start server at {_endpoint}");

            _listener = new ServerSocketListener(_endpoint, _hcname)
            {
                OnAcceptConnection = AcceptConnection, OnShutdown = ListenerShutdown
            };

            _open = true;
            await _listener.StartAsync().CfAwait();

            HConsole.WriteLine(this, "Server started");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Starts the server.
        /// </summary>
        /// <returns>A task that will complete when the server has started.</returns>
        public async Task StartAsync()
        {
            HConsole.WriteLine(this, $"Start server at {_endpoint}");

            _listener = new ServerSocketListener(_endpoint)
            {
                OnAcceptConnection = AcceptConnection, OnShutdown = ListenerShutdown
            };
            HConsole.Configure(_listener, config => config.SetIndent(24).SetPrefix("LISTENER"));
            _open = true;
            await _listener.StartAsync().CAF();

            HConsole.WriteLine(this, "Server started");
        }