CS228 -- The Networking Final

  1. What's going to happen in 17 days?
    1. We'll all party like it's 1999.
    2. The computers of the world will crash.
    3. I'll find out I got an 'A' in this class.
    4. Who care's, it's a new year anyway.
  2. Consider the two programs below.  What happens if I launch ONE server on euclid.nmu.edu, and the try and start TWO clients at nearly the same time, both on www.y2k.org?






  3. main() {
        struct sockaddr_in sa;

              int sa_len;
        char hostname[1024];
        sa.sin_port = htons(7777);
        gethostname(hostname, 1024);
        struct hostent *hp = gethostbyname(localhostname);
        bcopy((char *)hp->haddr, (char *)&sa.sin_addr, hp->h_length);
        int sock = socket(hp->h_addrtype, SOCK_STREAM, 0);
        bind(s, (struct sockaddr *)&sa, sizeof(sa));
        listen(s, 99);
        int fd = accept(s, (struct sockaddr *)&sa, (unsigned int *)sa_len);
        sleep(3600); // wait for one hour
        write(fd, "Hi\0", 3);
    }

    main() {
        struct sockaddr_in sa;

              int sa_len;
        sa.sin_port = htons(7777);
        struct hostent *hp = gethostbyname("euclid.nmu.edu");
        bcopy((char *)hp->haddr, (char *)&sa.sin_addr, hp->h_length);
        int sock = socket(hp->h_addrtype, SOCK_STREAM, 0);
        int fd = connect(sock, (struct sockaddr *)sa, sizeof(sa));
        read(fd, buf, 1024);

              cout << buf << endl;
    }
          
  4. What type of protocol does this program use?  (Pick ALL that apply)
    1. TCP
    2. UDP
    3. IP
    4. Aloha
  5. I have just turned the client (www.y2k.org) on.  I run the client program above.  How many packets might the gethostbyname send, and to whom?




  6. Assume I run one client and one server, and no errors occur.  Which of the following is true?  (Pick exactly ONE)
    1. When the client finishes the connect call, the server has finished accept.
    2. When the server finshes the socket() call, the client must have finished it's socket() call.
    3. When the client is at connect, the server is at bind.
    4. Both the server and client will run gethostbyname at the same time.
  7. Which is true about these protocols.  Put TCP or UDP next to each protocol.
    1. Lower latency.
    2. Higher bandwidth.
    3. Larger header.
    4. Retry after failure.
    5. Used by HTTP
    6. None of the above
  8. Suppose I modified my Ethernet card so that on every collision, I wait a random time between 0 ... 1000 miliSeconds and then retransmit.  Would this work? What would I notice about this new card?





  9. (Yes/No) Ethernet retransmitts if there is a collision.  When I run TCP over ethernet, does the TCP software still set timers and to detect lost packets?
  10. What is a page view?
    1. When a HTTP client downloads an item (file, picture, smell) from a web server.
    2. When a HTTP client finds an item in it's cache.
    3. When a HTTP server connects to a client.
    4. The sum of #1 and #2
    5. The sum of  #2 and #3
    6. None of the above
  11. Suppose NMU had 6000 laptop computers and only 7 class C addresses.  What protocol could be used to assign IP numbers to laptops? ________________________
  12. Given the data above, what percent of laptops could be in use at any one time?  __________________%
  13. I'm trying to learn about my application.  Through measurements, I know that my bandwidth to www.y2k.org is 20kbytes/second, and my latency is 100 milliseconds.  My application sends data from my host to www.y2k.org, and uses 200 milliseconds to send the data.  How much data is it sending? ______________
  14. If you just want to send one byte of data, and don't need a reply, why would you use TCP?




  15. (Yes/No) Do you use a 'listen' on a UDP port?
  16. Suppose a TCP connection is in the "slow start" phase. The current congestion window goes from (10,000-17,000). The window advertised by the receiver goes       from (10,000 - 12,000). The maximum segment size is 900 octets. Which bytes can be sent in the next segment?

  17.       ___________________________________________
  18. As a sender you keep sending packets, but a high percentage of them are not acknowledged on the first sending. What should you do? (pick all that apply)

  19.             a) Reduce your congestion-window-size.
                b) Increase your time out value.
                c) Send larger packets.
                d) Send smaller packets.
                e) Decrease your time out value
                 f) Give up hope -- the world is comming to an end anyway?
  20. Suppose a receiver gets packets containing bytes (1-100), (101-200) and (301-400). The receiver window size is 1000 bytes.  What should the receiver advertise as it's window?

  21.       _______________________________________________________________________________________________________________________________
  22. How can I tell if a web server is running http/0.9 and not http/1.1  Give TWO ways.
    _________________________________________________________________________________
    _________________________________________________________________________________