Embercode
✕
How the Internet WorksQuick quiz

TCP and UDP

8 questions. Covers UDP and when to skip reliability.

Questions 1 to 5 of 8

  1. 1. A server is 80 ms away, so the round-trip time (RTT) is 80 ms. The client sends its request as soon as the handshake ends. When does the request reach the server?
  2. 2. True or false: the receiver has bytes 1001 to 1004 and bytes 1009 to 1012, but not 1005 to 1008. Its next ACK says 1013.
  3. 3. Put these steps from the HELLO WORLD example in the order they happen.

    Use the arrows to put the steps in order.

    1. 1.The sender resends the chunk that starts at byte 1005 after a timeout
    2. 2.The receiver's ACK moves to 1014, so all 13 bytes have arrived
    3. 3.The receiver sends ACK 1005, and repeats it for each later chunk that arrives
    4. 4.The client sends four chunks, and chunk 2 (O WO, starting at byte 1005) is lost
  4. 4. A server program calls listen() but never calls accept(). A client calls connect() and gets no error. Why?
  5. 5. What does this program print? ``python import socket, threading srv = socket.socket() srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) srv.bind(("127.0.0.1", 9004)) srv.listen() def closer(): c, _ = srv.accept() c.sendall(b"partial") c.close() threading.Thread(target=closer).start() cl = socket.create_connection(("127.0.0.1", 9004)) print("read 1:", cl.recv(100)) print("read 2:", cl.recv(100)) cl.close() srv.close() ``

4 question(s) left on this page.