Example #1
0
 public ServerClient(TcpClient client, Serverapplication server, SslStream stream)
 {
     this.server = server;
     this.client = client;
     this.stream = stream;
     if (client != null)
     {
         new Thread(() =>
         {
             BinaryFormatter formatter = new BinaryFormatter();
             while (client.Connected)
             {
                 Packet packet = NetworkFlow.ReadPacket(stream);
                 if (packet != null)
                 {
                     Console.WriteLine("recieved packet");
                     packet.handleServerSide(this);
                 }
             }
             server.getConnectedClients().Remove(this);
             if (user != null)
             {
                 user.isOnline = false;
             }
             Console.WriteLine("Client disconnected");
         }).Start();
     }
 }
Example #2
0
 private void ReceiveThread()
 {
     while (true)
     {
         Packet packet = NetworkFlow.ReadPacket(ssl);
         if (packet != null)
         {
             packet.handleClientSide(parent);
         }
     }
 }