コード例 #1
0
 protected virtual void OnMissingPackets(MissingPacketEventArgs e)
 {
     if (MissingPackets != null)
     {
         MissingPackets(this, e);
     }
 }
コード例 #2
0
        /// <summary>
        /// Request resend of packets
        /// </summary>
        /// <param name="first"></param>
        /// <param name="last"></param>
        void requestResend(object sender, MissingPacketEventArgs e)
        {
            if (e.Last < e.First)
            {
                return;
            }

            int len = e.Last - e.First;

            byte[] request = new byte[] { (byte)0x80, (byte)(0x55 | 0x80), 0x01, 0x00, (byte)((e.First & 0xFF00) >> 8), (byte)(e.First & 0xFF), (byte)((len & 0xFF00) >> 8), (byte)(len & 0xFF) };

            lock (socketLock)
            {
                if (audioSocket != null)
                {
                    try
                    {
                        audioSocket.Send(request, request.Length, clientAddress.ToString(), audioSession.ControlPort);
                    }
                    catch (SocketException) { }
                }
            }
        }