Beispiel #1
0
        private async Task HandleClient(IConnectionClient tcpClient)
        {
            var clientId = tcpClient.GetId();

            _notification.Warning("Server", $"Client{clientId} connected!");

            var responseSender = new ResponseSender(tcpClient);

            await HandelNewMessage(tcpClient, responseSender);

            _notification.Error("Server", $"Client{clientId} dropped out");
        }
Beispiel #2
0
 private async Task HandleMessage(IRequestMessage strategy, string message)
 {
     try
     {
         await ResponseToRequest(strategy, message);
     }
     catch (ClientIsNotConnectException exception)
     {
         _notification.Error("Disconnect", exception.ToString());
     }
     catch (IOException exception)
     {
         _notification.Error("Disconnect", new ClientIsNotConnectException().ToString());
     }
     catch (InvalidRequestException exception)
     {
         _notification.Error("Not Allowed", exception.ToString());
     }
     catch (Exception exception)
     {
         HandelException(exception);
     }
 }