Exemplo n.º 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();
     }
 }
Exemplo n.º 2
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();
     }
 }
Exemplo n.º 3
0
 public ServerClient(TcpClient tcpClient, Serverapplication server)
 {
     this.server = server;
     this.tcpClient = tcpClient;
     stream = new SslStream(tcpClient.GetStream());
     new Thread(() =>
     {
         BinaryFormatter formatter = new BinaryFormatter();
         while (tcpClient.Connected)
         {
             Packet packet = (Packet)formatter.Deserialize(stream);
             packet.handleServerSide(this);
         }
     }).Start();
 }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Serverapplication server = new Serverapplication();

            System.Diagnostics.Debug.WriteLine("Tries");
        }