logo
Go to the homepage of the Vrije Universiteit. Go to the homepage of the department of computer science. Go to the homepage of the faculty of sciences.

<< Computer Networks Practicum: Questions and Answers


  1. What must be in the documentation?
  2. What must not be in the documentation?
  3. What can be in the documentation?
  4. The RFC states we must wait 5 minutes on connection close, it that true?
  5. I get an alignment error, what is that?
  6. What causes an alignment error?
  7. I have problems with pointers
  8. How do you write a Makefile?

1. What must be in the documentation?

  • Design of your implementation.
  • Everything that shows you thought about the problems involved in implementing and understanding network protocols
  • Everything that helps your advisor to quickly understand your complete solution.
  • A description of how you tested your implementation and the test cases you identified.

2. What must not be in the documentation?

  • Rephrased version of the assignment.
  • Your code in words.
  • A blow by blow account of your work for this class.

3. What can be in the documentation?

  • Descriptions of the problems you encountered during implementation.
  • Which solution you chose for these problems and why.

4. The RFC states we must wait 5 minutes on connection close, it that true?

Indeed, the operating system is supposed to wait a certain time before connections are released. This is supposed to wait for late data packets arriving after the connection has been closed. Of course, in normal implementations, this task is handled by the system and applications can go on without being blocked that long.

In our case, since each data packet has to be acknowledged before anything more can happen, we don't have this problem.

The only problem that remains is what happens if the FIN+ACK packet gets lost. In this case, the host initiating the connection should resend a FIN packet a certain number of times (in case it was the FIN packet that got lost), after which it assumes its partner has already closed its connection and the FIN_ACK packet was lost.

5. I get an alignment error, what is that?

In the console window (usually in the lower right corner) the IP library generates alignment errors. This is nothing to worry about on a PC, but a Sparc machine would crash. The Minix kernel sets the alignment flag for a new process, and when an alignment error occurs, the Minix kernel prints a message on the console (including the address where the error occured). To find the place in the source code, use 'dis program | less' and search for the address that was given.

To be clear, no process should give an alignment error. Here is an arp.c file without the alignment error, to replace the buggy one from the provided IP library.

6. What causes an alignment error?

Usually a 'ps = *(short *)&buffer[3];' or alike. If something is to be a short, then its address should be even. Malloc() always returns an 'even' pointer and the compile knows how to handle 'struct {char c; short s;}' (char c is patched to 2 bytes). The only way to get an mis-aligned address (pointer) is by using an odd offset in a buffer. Don't do this. The PC can handle this, but it shows bad programming.

To be clear, it will not look good if your program generates alignment warnings.

7. I have problems with pointers

A comprehensive understanding of pointers is essential to most C programming. You can read for example this C tutorial, which has a whole section about pointers here.

8. How do you write a Makefile?

A Makefile defines the relationships between files: to construct a given file (say, an executable file), it says which other (source) files are needed and what is the command to create the former based on the latter. Here is a small example:
    main: foo.o bar.o
        gcc -o main foo.o bar.o

    foo.o: foo.c foo.h bar.h
        gcc -o foo.o -c foo.c

    bar.o: bar.c bar.h
        gcc -o bar.o -c bar.c
Then running make main will perform all compilation steps (possibly including recompiling foo.o or bar.o) to generate an up-to-date version of main. It is very important that the command line (i.e., each gcc line in this example) starts with a TAB. Otherwise, your Makefile will not work. Normal spaces instead of a TAB will not work.

To clean up generated files, you can add a rule like that:

    clean:
        rm main *.o
Then, running make clean will remove main and all object files. A full reference on make can be found here, even though you only need to use very basic features.

If you have any comments, please e-mail the maintainer of this page.
Your browser does not fully support CSS. This may result in visual artifacts.