Mohamed G Gouda CS 326E Spring 2013 Midterm 2 ------------------------------------------------------------------------------- 1. Mention two objectives that both transport protocols UDP and TCP share. Sol: First, both UDP and TCP use their port numbers to name their applications. For example, the UDP port number 53 names the server of the DNS application (runnning on top of UDP). Also, the TCP port number 25 names the server of the SMTP application (running on top of TCP). Second, both UDP and TCP have checksums that can be used for end-to-end corruption detection. ------------------------------------------------------------------------------- 2.Mention two reasons why the DNS application is designed to run on top of UDP. Sol: First, it is cheaper (in terms of time and storage) to run DNS on top of UDP rather than on top of TCP. Second, the communication style in DNS is simple, consisting of sending one query then waiting to receive a reply. This communication style can be made reliable in a straightforward fashion without having to rely on the "heavy" reliable data transfer capability of TCP. ------------------------------------------------------------------------------- 3. A client apc communicates with a server aps over a TCP connection as follows. 1) Client apc sends a SYN segment whose seq# = 315 and whose ack# = "don't care". This segment is received correctly. 2) Server aps replies by sending a SYN-ACK segment whose seq# = 1009 and whose ack# = 316. This segment is received correctly. 3) Client apc replies by sending an ACK segment that has 512 data bytes. This segment is received correctly. 4) Server aps replies by sending one segment that has 512 data bytes. This segment is lost. 5) Server aps times out and resends its last segment which had 512 data bytes. This segment is received correctly. The seq# and ack# for the first 3 segments are as follows: SYN segment: seq# = 315 ack# = "don't care" SYN-ACK segment: seq# = 1009 ack# = 316 ACK segment from apc: seq# = 316 ack# = 1010 Compute the seq# and ack# for the last 2 segments. Sol: First data segment from aps: seq# = 1010 ack# = 828 Second data segment from aps: seq# = 1010 ack# = 828 ------------------------------------------------------------------------------- 4. Consider a TCP data byte stream from a client apc to a server aps. Assume that this data stream is in the following state: The seq# of the next data byte to be acknowledged (na) by aps = 4500 The seq# of the next data byte to be sent (ns) by apc = 5000 The seq# of the next data byte to be received (nr) by aps = 4700 The seq# of the next data byte to be read (nd) by aps = 4400 The size of the circular buffer to store the received data bytes from apc = 2000 bytes Compute the maximum number of data bytes that apc can send without receiving any acknowledgements from aps. Sol: The size wr of the receiving window in the circular buffer = buffer size - (nr - nd) which is equal to 1700. The size w of the window = wr which is equal to 1700. Without receiving any acknowledgements from aps, the maximum value of ns = na + wr which is equal to 6200. The maximum number of data bytes that apc can send without reeciving any aknowledgements from aps = na + wr - ns which is equal to 1200. -------------------------------------------------------------------------------