Porting SSP Code to Java and Implementing Missing Timer Classes and Functions

Last Updated: 19 Apr 2023
Essay type: Report
Pages: 2 Views: 234

However, the sample code provided In the lecture notes is in C. Therefore, this mall task is divided into the following sub-tasks: Port the SSP code to Java Implement missing timer related classes and functions The following sections will cover these three sub-tasks. Porting the code Minor changes were made in order to change the syntax of the code to Java. As see_nor was not specified in the given files, it was replaced with into type. In the original code, to declare a frame named s, it used the following syntax:

However, to create a frame object in Java, the code was modified accordingly. The same change was made to the following code: The resulting code was shown below. The out_buff and event were not declared here because they were pre-set in the given code. In order to make the piece of code below work, credits were added as parameter. As a result, it was changed to NOR_BUFFS was the maximum buffer size (window size) that could be held to avoid redundant retransmission. Therefore, It was put In as credit to Initialize the network layer with the same number of buffers. Implementation of classes and functions

Two timer related classes were Implemented for different timer purposes. D Peacetimes Peacetimes was to monitor and time how long had passed since a packet was transmitted. Cacciatore Cacciatore was to monitor the expiration of an acknowledgement timer. Both of them extended from the Timer Task class and overrode the run method to generate cacciatore_event. On the other hand, five functions were implemented to complete the protocol. Private void start_timer(into see) The start_timer started a timer function for each packet transmitted. If a packet timer already existed, it was cancelled.

Order custom essay Porting SSP Code to Java and Implementing Missing Timer Classes and Functions with free plagiarism report

feat icon 450+ experts on 30 subjects feat icon Starting from 3 hours delivery
Get Essay Help

When the timer of a packet had expired (time_out), that packet would be required to resend. Private void stop_timer(see) The stop_timer was to cancel the timer of a packet when it was called. Private void start_jack_timer() The start_jack_timer was to set a timer for an acknowledgement. This was to ensure that the sender could receive an acknowledgement within a reasonable time constraint. Originally, an acknowledgement should take advantage of piggybacking to travel to the sender. However, when there was no outgoing packet back to the sender, retransmission might take place. This caused redundant retransmission.

Therefore, his timer was created. If it timed out, a separate acknowledgement would be sent to the sender to indicate the packet was received successfully. If there was already an acknowledgement timer, the current timer would be cancelled. Private void stop_jack_timer() The stop_jack_timer was to stop the acknowledgement timer if there already existed one. However, in order to get the timers work, two files were imported. Inc(mum) This Inc function simply incremented the input parameter's value by 1 . As there implemented as (mum + 1) % (MAX_SEE + 1). This would ensure that the number would increment in a circular manner.

Cite this Page

Porting SSP Code to Java and Implementing Missing Timer Classes and Functions. (2017, Nov 27). Retrieved from https://phdessay.com/website-report/

Don't let plagiarism ruin your grade

Run a free check or have your essay done for you

plagiarism ruin image

We use cookies to give you the best experience possible. By continuing we’ll assume you’re on board with our cookie policy

Save time and let our verified experts help you.

Hire writer