コード例 #1
0
        public TestServer(TestServerOptions options = null)
        {
            options = options ?? new TestServerOptions();
            _connectionDispatcher = options.ConnectionDispatcher;
            var transportOptions = new LinuxTransportOptions()
            {
                ThreadCount = options.ThreadCount,
                DeferAccept = options.DeferAccept,
                AioReceive  = options.AioReceive,
                AioSend     = options.AioSend,
                ApplicationSchedulingMode = options.ApplicationSchedulingMode,
            };
            var      loggerFactory = new LoggerFactory();
            EndPoint endPoint      = null;

            if (options.UnixSocketPath != null)
            {
                _unixSocketPath = options.UnixSocketPath;
                endPoint        = new UnixDomainSocketEndPoint(_unixSocketPath);
            }
            else
            {
                _serverAddress = options.IPEndPoint ?? new IPEndPoint(IPAddress.Loopback, 0);
                endPoint       = _serverAddress;
            }
            _transport = new Transport(endPoint, transportOptions, loggerFactory);
        }
コード例 #2
0
        public TestServer(TestServerOptions options = null)
        {
            options            = options ?? new TestServerOptions();
            _connectionHandler = options.ConnectionHandler;
            _serverAddress     = new IPEndPoint(IPAddress.Loopback, 0);
            var transportOptions = new LinuxTransportOptions()
            {
                ThreadCount = options.ThreadCount,
                DeferAccept = options.DeferAccept
            };
            var loggerFactory = new LoggerFactory();

            loggerFactory.AddConsole((n, l) => false);
            _transport = new Transport(_serverAddress, this, transportOptions, loggerFactory);
        }