/// <summary>
 /// Receive thread.</summary>
 private void ReceiveThread()
 {
     while (true)
     {
         Packet packet = NetworkCommunication.ReadPacket(ssl);
         if (packet != null)
         {
             packet.handleClientSide(parent);
         }
     }
 }
Beispiel #2
0
 public ServerClient(TcpClient client, ServerApplication server, SslStream stream)
 {
     this.server = server;
     this.stream = stream;
     if (client != null)
     {
         new Thread(() =>
         {
             while (client.Connected)
             {
                 Packet packet = NetworkCommunication.ReadPacket(stream);
                 if (packet != null)
                 {
                     Console.WriteLine("recieved packet");
                     packet.handleServerSide(this);
                 }
             }
             //When disconnected:
             server.ConnectedClients.Remove(this);
             Console.WriteLine("Client disconnected");
         }).Start();
     }
 }