Exemplo n.º 1
0
        private void NewClientConnectionHandler(IAsyncResult ar)
        {
            try
            {
                lock (Receivers)
                {
                    Client.Client <TModel> newClient = new Client.Client <TModel>();
                    newClient.SetDefaultMessages(DefaultSignOnMessage, DefaultSignOffMessage, DefaultLifeCheckMessage);

                    newClient.BuildBridge(EndAcceptTcpClient(ar), IsLifeCheckActivated);

                    SetClientHandlers(ref newClient);

                    Receivers.Add(newClient);
                    OnClientConnected(newClient);
                }

                WaitForConnection();
            }
            catch (Exception ex)
            {
                OnError(ex);
            }
        }