Ejemplo n.º 1
0
        /**********************************************************************
         *********************************************************************/
        //Receiver sends ACK
        public static void SendACKFor(int seqnum)
        {
            if (!stopEverything)
            {
                //define object
                float yPos = 15 + (65 * (28 - seqnum)); //where the box !starts!
                OldPipelineProtocolsACK pp;

                //smaller rectangle at --
                switch (seqnum)
                {
                case -1:
                    pp   = new OldPipelineProtocolsACK(seqnum, 5, 1);
                    yPos = yPos + 12;     //since it's smaller, it has to be a little further up, in order to look pretty
                    break;

                default:
                    pp = new OldPipelineProtocolsACK(seqnum, 0);
                    break;
                }
                pp.Position = new CCPoint(280, yPos);
                layer.AddChild(pp);

                //define action
                float timeToTake        = 5f;
                var   distance          = new CCPoint(80, yPos);              //82 to 278 = 278-82 = 196
                var   sendPackageAction = new CCMoveTo(timeToTake, distance); //this action moves the object 196 in x-direction within 5 seconds
                var   removeAction      = new CCRemoveSelf();                 //this action removes the object*/

                //define sequence of actions and apply to object
                var cc_seq1 = new CCSequence(sendPackageAction, removeAction);
                pp.RunAction(cc_seq1);
            }
        }
Ejemplo n.º 2
0
 public static void AckArrived(OldPipelineProtocolsACK aa)
 {
     //if there has no other Ack with the same seqnum has arrived before
     if (!arrivedAck.Any() || arrivedAck.Any() && !arrivedAck.Contains(aa.seqnum))
     {
         arrivedAck.Add(aa.seqnum);
         pendingAck.Remove(aa.seqnum);
         DrawFillLeft2(aa.seqnum);
         baseOfWindowLeft = FindFirstNotYetArrivedAck();
         DrawWindowLeft(baseOfWindowLeft);
     }
     layer.RemoveChild(aa);
 }
Ejemplo n.º 3
0
        /**********************************************************************
         *********************************************************************/
        public static void SlowDownAck(OldPipelineProtocolsACK aa, int xPos)
        {
            //stop running actions
            aa.StopAllActions();

            //define actions
            float yPos              = 15 + (65 * (28 - aa.seqnum));
            float timeToTake        = 8f;
            var   distance          = new CCPoint(80, yPos);
            var   sendPackageAction = new CCMoveTo(timeToTake, distance); //this action moves the Object to the CCPoint
            var   removeAction      = new CCRemoveSelf();                 //this action removes the object*/

            //define sequence of actions and apply to object
            var cc_seq1 = new CCSequence(sendPackageAction, removeAction);

            aa.RunAction(cc_seq1);
        }
Ejemplo n.º 4
0
        public static void AckArrived(OldPipelineProtocolsACK aa)
        {
            //if there has no other Ack with the same seqnum has arrived before
            if (!arrivedAck.Any() || arrivedAck.Any() && !arrivedAck.Contains(aa.seqnum))
            {
                //kummulatives ACK
                for (int i = 0; i <= aa.seqnum; i++)
                {
                    if (pendingAck.Any() && pendingAck.Contains(i))
                    {
                        arrivedAck.Add(i);
                        DrawFillLeft2(i);
                        pendingAck.Remove(i);
                    }
                }

                baseOfWindowLeft = FindFirstNotYetArrivedAck();
                DrawWindow(baseOfWindowLeft);
            }
            layer.RemoveChild(aa);
        }
Ejemplo n.º 5
0
 public static void AckLost(OldPipelineProtocolsACK aa)
 {
 }
Ejemplo n.º 6
0
 /**********************************************************************
  *********************************************************************/
 public static void AckCorrupt(OldPipelineProtocolsACK aa)
 {
 }