J. Blustein

Network Computing

[Crs | Ann | Mats | Res]

Kurose & Ross's Network Simulation Code

[Assignment | Documentation | Source Code ]

Assignment: [instructions | Alternating Bit Protocol | Go-Back-N | submission | FAQ ]

Questions and Answers

These are answers to questions I've received about the assignment from students.


List of Questions

  1. Questions about make and compiling
  2. Question about clientOutput()
  3. Questions about set_pkt_data()
  4. Questions about alternating bit protocol
  5. Questions about paramaters to run the code with
  6. Questions about the statistics you should collect

Questions and Answers

  1. Questions about make and compile messages
    1. Q: I'm seeing warning messages when I compile. Are these okay? (The messages are reproduced below)
      A: If you have not changed the files then you should expect to see these warnings:
      torch: ~/CS3171/A4$ make simABP
      torch: ~/CS3171/A4$ gcc -ansi -pedantic -g -Wall  -I. -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes  -c KRnet.c
      timer.c:127: warning: `checktimer' defined but not used
      gcc -ansi -pedantic -g -Wall  -I. -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes  -c packet.c
      gcc -ansi -pedantic -g -Wall  -I. -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes  -c message.c
      gcc -ansi -pedantic -g -Wall  -I. -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes  -c queue.c  
      gcc -ansi -pedantic -g -Wall  -I. -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes  -c -o ABP/client.o ABP/client.c
      ABP/client.c:47: warning: `startTimer' defined but not used
      ABP/client.c:52: warning: `cancelTimer' defined but not used
      ABP/client.c:38: warning: `sendToNWSlayer' defined but not used
      ABP/client.c:42: warning: `deliverToAppLayer' defined but not used
      gcc -ansi -pedantic -g -Wall  -I. -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes  -c -o ABP/server.o ABP/server.c
      ABP/server.c:47: warning: `startTimer' defined but not used
      ABP/server.c:52: warning: `cancelTimer' defined but not used
      ABP/server.c:38: warning: `sendToNWSlayer' defined but not used
      ABP/server.c:42: warning: `deliverToAppLayer' defined but not used
      gcc -ansi -pedantic -g -Wall  -I. -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes   KRnet.o packet.o message.o queue.o ABP/client.o ABP/server.o -o simABP -lm
      torch: ~/CS3171/A4$ 
      
    2. Q: What is the name of the executable file?
      A: simABP

      [return to list of questions]


  2. Question about clientOutput()
    1. Q: clientOutput() receives type message_t messages. Do we have to create multiple packets of this message or do we assume that each message can be stuffed in one packet.
      A: Normally you should create multiple packets from each message. This should be easy to do with a loop. However in this assignment, the packet size is the same as the message size so nothing needs to be split up.

    [return to list of questions]


  3. Questions about set_pkt_data()
    1. Q: set_pkt_data() takes a char* for its last argument. But what we are getting is message_t type. How can this be?
      A:
      1. Use msg_data() to access the field, and
      2. Use strncpy() (from <string.h>) to copy the char* variable.
    2. Q: set_pkt_data() has a field for ack_num, but in unidirectional flow a client does not need to send any ACK to server. Is it appropriate to set this value to a constant or should we just ignore this value?
      A: It is up to you, as the programmer, to decide. As a matter of style I would set the ACK to an impossible (constant) value in case it was read by the server.
    3. Q: How can I set the value of the checksum field?
      A: Remember that the message_t and packet_t are opaque types, i.e. your code can only use them through the interface that is provided. This happens often in real world programming.

      You must use set_pkt_data() to set the values and the pkt_*() functions to read the values. A simple way to set only the checksum field of packet_t packet to a value x, for example, would be:

      set_pkt_data(packet,
                   pkt_seq(packet),
                   pkt_ack(packet), 
                   x,
                   pkt_data(packet));

      If you are (overly) worried about the efficency of this method then remember that the compiler has access to all of the information and could optimize away the function calls.


    [return to list of questions]


  4. Questions about alternating bit protocol
    1. Q: Which rdt protocol are we implementing as ABP?
      A: rdt3.0 (Reliable data transfer over a Lossy Channel with Bit Errors).
    2. Q: The client might break up the message into several packets. Should the server combine the packets before sending them up to the application layer or should it deliver each packet as soon as it gets each packet?
      A: The message should be reassembled in the transport layer. Only complete messages should be sent to the application layer. The application layer should not need to know anything about packets. But in this simulation, the size of the message and the packet's payload are the same, so nothing needs needs to be split up (for this assignment).
    3. Q: The textbook does not show an EFSM for the rdt3.0 receiver. How do we know what to code for the server?
      A: The rdt3.0 receiver is the same as the rdt2.2 receiver (Figure 3.14). Note that, in the first edition, there is a minor typo in the figure (sndpkt is written as sendpkt in some places).
      Implement the rdt2.2 receiver as your rdt3.0 server.
    4. Q: My program compiles, but when it runs I never see any packets leaving the client and getting to the server, even with TRACE==4. What's wrong?
      A: Alternating-bit protocol can only send a packet if the previous packet has been correctly acknowledged. Your clientCanSendMorePkt() function is called by the simulation to make sure that the client is ready to send another packet. If that function is not working then your data will not leave the client.

    [return to list of questions]


  5. Questions about paramaters to run the code with
    1. Q: How long should the timer be set for?
      A: Allow between 10 and 15 units for a timeout.

      [return to list of questions]


  6. Questions about the statistics you should collect
    1. Q: How do we access KRtime?
      A: Declare it as an external variable: extern float KRtime;
    2. Q: How can I collect those statistics? Nothing in client.c or server.c has access to all of the necessary variables.
      A: You need to collect some of the values in the client and others in the server. You can use clientEnd() and serverEnd() to print them.

      You will need to compute the division manually because no part of the simulation code has access to all of the variables. Include the answer for a typical run of your program (with the parameters you used, and so on) in a comment at the top of your client.c file.

    3. Q: For data sent divided by total data transmitted what exactly do you mean?
      A:
      bytes sent (successfully or unsuccessfully)
      
       divided by
      
         bytes sent (successfully or unsuccessfully)
      + acknowledgments sent (successfully or unsuccessfully)

      [return to list of questions]


http://web.cs.dal.ca/~jamie/course/CS/3171/Materials/KR_1e/Code/Chapter3/assig/faq.shtml
Version:
Monday, 28-Jul-2003 08:13:05 ADT
CS 3171 Prof.:
J. Blustein <jamie@cs.dal.ca>

This webpage uses valid XHTML 1.0

Assignment based on
document at <URL:about:http://occawlonline.pearsoned.com/bookbind/pubbooks/kurose-ross1/chapter4/custom12/deluxe-content.html> (copied on 05 July 2002). That document is © 2000-2001 by Addison Wesley Longman A division of Pearson Education