Ejemplo n.º 1
0
        public async void ListenForClients()
        {
            while (ServerIsRunning)
            {
                TcpClient tcpClient = await this._tcpListener.AcceptTcpClientAsync();

                NetworkStream stream = tcpClient.GetStream();

                ClientHandling client = new ClientHandling(this, stream);

                RecentlyConnectedClient = client;
                
                SubscribeEvents(client);

                client.StartReadingAsync();
            }
        }
Ejemplo n.º 2
0
 private void SubscribeEvents(ClientHandling client)
 {
     client.IncomingLoginMessage += _metaData.OnIncomingLoginMessageCallback;
     client.IncomingRegisterMessage += _metaData.OnIncomingRegisterMessageeCallback;
     client.IncomingUserMessage += _metaData.OnIncomingUserMessageCallback;
     client.IncomingSeekFriendsRequestMessage += _metaData.OnIncomingSeekFriendsRequestMessageCallback;
     client.IncomingErrorMessage += _metaData.OnIncomingErrorMessageCallback;
     client.IncomingFriendlistMessage += _metaData.OnIncomingFriendlistMessageCallback;
 }