Esempio n. 1
0
        public TcpNETServerAuth(IParamsTcpServerAuth parameters,
                                IUserService <T> userService,
                                TcpHandler handler = null)
        {
            _parameters        = parameters;
            _userService       = userService;
            _connectionManager = new TcpConnectionManagerAuth <T>();

            _handler = handler ?? new TcpHandler(_parameters);
            _handler.ConnectionEvent += OnConnectionEvent;
            _handler.MessageEvent    += OnMessageEventAsync;
            _handler.ErrorEvent      += OnErrorEvent;
            _handler.ServerEvent     += OnServerEvent;
        }
        public TcpNETServerAuth(IParamsTcpServerAuth parameters,
                                IUserService <T> userService,
                                byte[] certificate,
                                string certificatePassword,
                                TcpHandler handler = null,
                                TcpConnectionManagerAuth <T> connectionManager = null)
        {
            _parameters        = parameters;
            _userService       = userService;
            _connectionManager = connectionManager ?? new TcpConnectionManagerAuth <T>();

            _handler = handler ?? new TcpHandler(_parameters, certificate, certificatePassword);
            _handler.ConnectionEvent += OnConnectionEvent;
            _handler.MessageEvent    += OnMessageEventAsync;
            _handler.ErrorEvent      += OnErrorEvent;
            _handler.ServerEvent     += OnServerEvent;
        }