Beispiel #1
0
 private void sendRetryFrame()
 {
     Frame retFrame = new Frame(new byte[0], Data.RETFrame);
     stopSendingFrames();
     Console.WriteLine("Sending RET...");
     physicalLayer.sendFrame(retFrame.serialize());
     continueSendingFrames();
 }
Beispiel #2
0
 private void sendLinkAckFrame()
 {
     Frame LinkACKFrame = new Frame(new byte[0], Data.LINK_ACKFrame);
     while (!canSend) { }
     stopSendingFrames();
     Console.WriteLine("Sending LINK_ACK...");
     physicalLayer.sendFrame(LinkACKFrame.serialize());
     continueSendingFrames();
 }
Beispiel #3
0
        private void sendLinkFrame()
        {
            while (true)
            {
                if (physicalLayer.connectionActive)
                {
                    if (linkFramesSended >= 3)
                    {
                        linkStatus = false;
                        return;
                    }
                    else
                    {
                        if (canSend)
                        {
                            Frame LinkFrame = new Frame(new byte[0], Data.LINKFrame);

                            stopSendingFrames();
                            Console.WriteLine("Sending LINK...");
                            physicalLayer.sendFrame(LinkFrame.serialize());
                            continueSendingFrames();

                            linkFramesSended += 1;
                        }

                    }

                }
                Thread.Sleep(Data.LinkFrameTimeout);
            }
        }
Beispiel #4
0
        //Обработка информационного кадра
        private void processInfoFrame(Frame frame)
        {
            Frame ackFrame = new Frame(new byte[0], Data.ACKFrame);

                Console.WriteLine(getString(frame.getData()));

                stopSendingFrames();
                Console.WriteLine("Sending ACK...");
                physicalLayer.sendFrame(ackFrame.serialize());
                continueSendingFrames();

                this.stringsBuffer.Enqueue(getString(frame.getData()));
        }