Example #1
0
 static void SendPacket(Packet packet)
 {
     if (computers.ContainsKey(packet.Destination))
     {
         computers[packet.Destination].EnqueuePacket(packet);
         Console.WriteLine(packet.Source + " -> " + packet.Destination + ": " + packet.X + " " + packet.Y);
     }
     else
     {
         if (packet.Destination == 255)
         {
             Console.WriteLine(packet.Source + " -> NAT: " + packet.X + " " + packet.Y);
             Nat.ReceivePacket(packet);
         }
         else
         {
             Console.WriteLine("!!! " + packet.Source + " -> " + packet.Destination + ": " + packet.X + " " + packet.Y);
         }
     }
 }