/// <summary> /// Sends a datagram with the specified AckResolver info /// The datagram must be sent reliably, but the AckResolver /// is already in the buffer, so there's no need to add it again. /// </summary> /// <param name="resolver">The AckResolver with the datagram info</param> private void SendDatagram(AckResolver resolver) { byte[] msgBytes; // Append the ack index count to the message, to communicate to the // client what reliable datagram count it represents msgBytes = Encoding.ASCII.GetBytes(Reliable.CreateString(resolver.AckIndex, resolver.Message)); _client.Send(msgBytes, msgBytes.Length); }
/// <summary> /// Adds a new AckResolver to the resolver buffer /// </summary> /// <param name="resolver">The new AckResolver to add</param> private void AddAckResolver(AckResolver resolver) { // Retrieve the AckResolver List (if it exists) for // the specified connection, and add the new AckResolver // to the List lock (_listLock) { _resolverBuffer.Add(resolver); _resolverBuffer.Sort((ack1, ack2) => ack1.AckIndex.CompareTo(ack2.AckIndex)); } }