public void Send(Object message, NetFrame.FrameType type)
 {
     ENet.Packet packet = new ENet.Packet();
     NetFrame f = new NetFrame(message, type);
     MemoryStream stream = new MemoryStream(512); // TODO : buffer size ?
     BinaryFormatter formater = new BinaryFormatter();
     formater.Serialize(stream, f);
     packet.Initialize(stream.GetBuffer(), ENet.PacketFlags.UnreliableFragment);
     server.Send(0, packet);
     client.Flush();
 }
 public void SendReliable(Object message, NetFrame.FrameType type, Player player)
 {
     ENet.Peer destination = playerMap[player];
     ENet.Packet packet = new ENet.Packet();
     NetFrame f = new NetFrame(message, type);
     MemoryStream stream = new MemoryStream(512); // TODO : buffer size ?
     BinaryFormatter formater = new BinaryFormatter();
     formater.Serialize(stream, f);
     packet.Initialize(stream.GetBuffer(), ENet.PacketFlags.Reliable);
     destination.Send((byte)(clients.IndexOf(destination) * 2 + 1), packet);
     server.Flush();
 }