Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Could sombody please help me implementing the receiver and sender port number in

ID: 3657764 • Letter: C

Question

Could sombody please help me implementing the receiver and sender port number in the given code as well as implementing the check sum.

the transport layer should break down the application layer data into smaller chunks of 6 bytes each. It then creates a simple transport layer segment by prepending the sender and receiver port numbers to the application layer chunk and send the segment down to the network layer. If the last fragment of the application layer data is less than 6 bytes in length, then the transport layer should pad the chunk with spaces to make it six bytes long. Each of the sender and receiver port numbers should be 4 bytes (32 bits) long.


Sender:

Port number: 7777


Receiver:

Port number: 8888


TransportLayer.java

public class TransportLayer {

private NetworkLayer networkLayer;

public TransportLayer()
{
networkLayer = new NetworkLayer();
}

public void send(byte[] payload)
{
networkLayer.send( payload );
}

public byte[] receive()
{
byte[] payload = networkLayer.receive();
return payload;
}

}

Explanation / Answer

http://www.redbooks.ibm.com/redbooks/pdfs/sg245081.pdf