public void SendReliable(String message, ENet.Peer destination) { ENet.Packet packet = new ENet.Packet(); byte[] buffer = Encoding.ASCII.GetBytes(message); packet.Initialize(buffer, ENet.PacketFlags.Reliable); destination.Send((byte)(clients.IndexOf(destination) * 2 + 1), packet); }
public void SendReliable(Object message, NetFrame.FrameType type, ENet.Peer destination) { 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(); }
public void SendReliable(byte[] message, ENet.Peer destination) { ENet.Packet packet = new ENet.Packet(); packet.Initialize(message, ENet.PacketFlags.Reliable); destination.Send((byte)(clients.IndexOf(destination) * 2 + 1), packet); }