transport layer Flashcards
what does the transport layer do
provides logical communication between application processes running on different hosts
what is the senders role in the transport layer
breaks the application message into segments, determines the header field values and passes them on to the network layer
what is the role of the receiver on the transport layer
reassembles the segments into messages by using the header values and demultiplexes the message to the application layer
multiplexing as a sender
data from multiple sockets is combined and when broken into segments the transport header allows them to be reassembled
demultiplexing as the receiver
the header info it used to deliver the segments to the correct socket or appropriate application
connectionless demultiplexing
the receiver uses the destination port number to direct the segment to the right socket
how do applications get the port number
they negotiate with the os and once its gotten it is attached to all outgoing udp packets
this allows the os to choose which applications get access to the network layer
how are ports like queues
the os creates an internal queue when it provides the port number
a buffer is attached to sockets so incoming data can join and wait its turn to be processed
if its full the data is dropped due to buffer overload
if the port number doesn’t match any ports it is discarded and a port unreachable icmp packet is sent
connection oriented demultiplexing
a handshake is required before transmission
each socket is identified by a 4 tuple; source and destination port number and ip which are all used to direct each segment to the appropriate socket
what are the key components of udp (3)
no delay or bandwidth guarantees
a best effort service; segments may be lost or delivered out of order
doesn’t require a handshake before transmission
how can you add more reliability to udp
adding it in the application layer or having appliation-specific error recovery
how are segments handled in udp
independently as the order isn’t important
what are some key points about the udp header (2)
smaller header size only 8 bytes long
no congestion control so can go as fast as possible
checksum
detects errors in the transmitted segment
how do checksums work
the sender treats the contents of the segment as a sequence of 16 bit integers and adds them up and the value is put into the checksum field of the udp header
the receiver computes the checksum of the received segment and compares it with the value in the header
if they’re the same then threes no errors
what is one of the problems with checksums
if there is an even amount of errors it wont be detected
rdt
reliable data transfer protocol
how does rdt work over a reliable channel
the sender waits for the application layer to send the data and adds a header to it
the receiver waits for the recv call from the network layer
stop and wait protocol
once the sender sends a packet it waits for an ack/nak
how does rdt work on a channel with bit errors
the sender transmits the packet and waits for an ack/nak and resends the packet if it gets an nak
the receiver sends an nak if the packet is corrupt and an ack if not
when working on a channel with only bit errors how do we solve the issue of the ack potentially being corrupted
when the sender resends the same packet, this may be a duplicate therefore we add sequence numbers (0 and 1 suffices) to indicate whether a packet is a duplicate
ack
acknowledge; sent by the receiver if a packet isn’t corrupted
nak
negative acknowledgement; sent by the receiver when the packet is corrupt
how does an nak-free protocol work
when a packet is corrupted the receiver sends the acknowledgment of the last uncorrupted packet including its sequence number
how does rdt work on channels with errors and potential losses
the sender starts a timer when it sends a packet and if it doesnt get an ack before the timer runs out, it assumes its lost and resends it
once an ack is received the timer is stopped
what causes the bad performance on channels with errors and potential losses and how do we fix it
whilst the packet is being transmitted and the ack is being sent back the channel isn’t being used at all
fixed with pipelining; sending multiple yet-to-be-acknowledged packets
cumulative ack
acknowledges all packets up to and including the sequence number
how does go-back-N work on the sender side
the sender has a window of up to N packets that it can send
once an ack has been received, the window is moved forward so it starts at n+1
the sender has a timer for the oldest in flight packet and if the ack doesn’t come withing the timeout then it’ll go back and resend it
how does go-back-N work on the receiver side
the receiver expects the packets in order
if the next sequence number expected isn’t the one on the next packet, it is buffered/ discarded and it re-ack the packet with the highest in order sequence number so the sender knows where to start resending from