/// <summary> /// Sends the given packet to the server, using a reliable QoS. /// </summary> /// <param name="packet">the packet to send</param> public void Send(PacketBase packet) { if (!connected) { NetUtils.DebugWriteError("Cannot send, client not connected!"); return; } writer.Reset(); packet.Serialize(writer); server.Send(writer, SendOptions.ReliableUnordered); }
/// <summary> /// Sends raw data to the given client by serializing the packet. /// This function uses the reliable channel. /// </summary> /// <param name="client">receiver</param> /// <param name="packet">data to be sent</param> private void Send(NetPeer client, PacketBase packet) { writer.Reset(); packet.Serialize(writer); client.Send(writer, SendOptions.ReliableOrdered); }