======================= Midterm Test #2 Answers ======================= - Ian! D. Allen - idallen@idallen.ca - www.idallen.com Test #2 Written Answer Section - Points: 68 (20 of 20%) Read both sides! Closed book. No aids. No electronic devices. 1. [Points: 1] The single 32-bit TCP header Acknowledgement number permits selective acknowledgement of packets, e.g. I got packets 1, 2, and 4 (but not 3): FALSE 2. [Points: 1] The IP packet header contains IP addresses and port numbers: FALSE 3. [Points: 1] When reading the ABNF rules given in RFC documents, quoted strings (e.g. "HELO") are not case-sensitive: TRUE 4. [Points: 1] When two systems attempt simultaneous TCP connections with each other, the protocol ensures that they end up with one single bidirectional TCP stream, not two streams: TRUE 5. [Points: 2] Describe briefly two functions of ICMP on the Internet. [Announce network errors, Announce network congestion, Assist Troubleshooting, Announce Timeouts, etc.] 6. [Points: 1] What interior/internal routing protocol is replacing the old RIP protocol? [OSPF] 7. [Points: 1] What Unix/Linux system call allows you to manipulate TCP/IP options such as SO_REUSEADDR? [setsockopt()] 8. [Points: 1] Why aren't the source and destination IP addresses given in the TCP/UDP header? [they are in the IP header] 9. [Points: 2] Describe two ways your program can know it has read all bytes sent from a remote client: [send the number of bytes at the start or use a record-termination sequence (e.g NL) to signal end of data segment] 10. [Points: 4] The TCP sliding window feature classes bytes into four categories. Describe each. http://www.tcpipguide.com/free/t_TCPSlidingWindowDataTransferandAcknowledgementMech.htm #1: Bytes Sent And Acknowledged #2: Bytes Sent But Not Yet Acknowledged #3: Bytes Not Yet Sent For Which Recipient Is Ready #4: Bytes Not Yet Sent For Which Recipient Is Not Ready 11. [Points: 2] What does TCP "slow start" mean? How does it work? Why is it needed? http://www.tcpipguide.com/free/t_TCPCongestionHandlingandCongestionAvoidanceAlgorit-2.htm ["Each sender is at first restricted to sending only an amount of data equal to one "full-sized" segment-that is, equal to the MSS value for the connection. Each time an acknowledgment is received, the amount of data the device can send is increased by the size of another full-sized segment." [...] "In a busy internetwork the sudden appearance of a large amount of new traffic could exacerbate any existing congestion."] 12. [Points: 3] Show, in order, the TCP flags used in the basic TCP three-way handshake. Clearly indicate which flags are sent by server and which by client. [C=SYN; S=SYN,ACK; C=ACK] 13. [Points: 2] Describe briefly two reasons why IP packet fragmentation should be avoided. [inefficient use of resources, degraded performance (in reassembly, fragment loss), lack of efficient reassembly] 14. [Points: 2] What is the content and purpose of the TCP and UDP "pseudo-header"? (Why is it necessary?) ["contains the source address, the destination address, the protocol, and the UDP length. This information gives protection against misrouted datagrams."] 15. [Points: 2] What happens when a Unix/Linux process writes data onto a closed socket, e.g. using write() or send()? [SIGPIPE is sent to the process] 16. [Points: 2] Why does client.c (Lab 4) need to use a shutdown() system call? What is being shut down and why? [shut down writing half of server socket to create EOF at server - because socket is open in two processes and therefore close() will not generate EOF] 17. [Points: 10] In your exam booklet, write detailed PDL for a TCP port scanner. (This detailed PDL represents all the code you wrote for Lab 3.) [see your class notes] 18. [Points: 20] In your exam booklet, write detailed PDL for the forking multi-process "echo"-style server that accepts multiple client connections and loops the client data received back to the client. (This detailed PDL represents all the code you wrote for server2.c in Lab 4.) Do not include the PDL for the sendall() function. Pay close attention to the handling of all socket descriptors. [see your class notes] 19. [Points: 10] In your exam booklet, write PDL for the forking multi-process echo client that connects to the above echo server. (This detailed PDL represents all the code you wrote for client.c in Lab 4.) Give the detailed PDL for the creation and management of the parent/child processes and sockets. Do not code any PDL for the two read/write loops in the client. Do not code any PDL for the sendall() function. Pay close attention to process management and the handling of all socket descriptors. [see your class notes]