예제 #1
0
 public NTierServerAuth(INTierServerParamsAuth parameters, IUserService <T> userService, byte[] certificate, string certificatePassword)
 {
     _server = new TcpNETServerAuth <T>(new ParamsTcpServerAuth
     {
         ConnectionSuccessString      = parameters.ConnectionSuccessString,
         ConnectionUnauthorizedString = parameters.ConnectionUnauthorizedString,
         EndOfLineCharacters          = "\r\n",
         Port = parameters.Port
     }, userService, certificate, certificatePassword);
     _server.ConnectionEvent += OnConnectionEvent;
     _server.ErrorEvent      += OnErrorEvent;
     _server.MessageEvent    += OnMessageEvent;
     _server.ServerEvent     += OnServerEvent;
 }
예제 #2
0
        static async Task Main(string[] args)
        {
            _authServer = new TcpNETServerAuth <Guid>(new ParamsTcpServerAuth
            {
                ConnectionSuccessString = "Connected Successfully",
                EndOfLineCharacters     = "\r\n",
                Port = 8989,
                ConnectionUnauthorizedString = "Not authorized"
            }, new MockUserService());
            _authServer.MessageEvent    += OnMessageEvent;
            _authServer.ServerEvent     += OnServerEvent;
            _authServer.ConnectionEvent += OnConnectionEvent;
            _authServer.ErrorEvent      += OnErrorEvent;
            await _authServer.StartAsync();

            while (true)
            {
                Console.ReadLine();
            }
        }