CITS3002 Computer Networks  
prev
next CITS3002 help3002 CITS3002 schedule  

Detecting Frame Loss, continued

Still in the sender:

#define ESTIMATED_ROUND_TRIP_TIME     20000    // microseconds

void physical_layer_ready(...)    // frame arrived
{
    FRAME ackframe;
    int   link, acklen;           // local variables

    stop_timer();

    READ_PHYSICAL_LAYER(&link, &ackframe, &acklen);

    if(ackframe.type == DLL_ACK) {
        start_network_layer();
    }
    else {
        link = 1;
        WRITE_PHYSICAL_LAYER(link, &frame, FRAME_SIZE(frame));

        start_timer( ESTIMATED_ROUND_TRIP_TIME );
    }
}


void timer_has_expired(...)       // a timeout
{
    int  link = 1;

    WRITE_PHYSICAL_LAYER(link, &frame, FRAME_SIZE(frame));

    start_timer( ESTIMATED_ROUND_TRIP_TIME );
}

There should be no need to change the receiver!


CITS3002 Computer Networks, Lecture 3, Data Link Layer protocols, p9, 13th March 2024.