–Students will read and write from and into binary files.
–Students will calculate the CRC32 value of a sequence of bytes.
Create a working directory for the lab activities. Copy the source files from /home/lib3780/project/src/4get data/ folder into this working folder.
Examine the contents of file create file.cc. Understand the code, then compile it and execute it. A binary file with the name one.bin should be created. Open the binary file using the command hexdump. Is the contents of one.bin correct?
g++ =o create file ./ create file hexdump =C one . bin create file . cc
Modify the source create file.cc as follows. Using the same buffer of maximum 20 characters, add a loop and write 93 bytes in a file named two.bin. The bytes written should have the value 0,1,2,...,92 in this order. Use hexdump to verify your outcome.
Examine the contents of file open file.cc. Understand the code, then compile it and execute it.
Modify the source open file.cc to read from a file until the end of the file is reached. Consult the resource document. You may choose to increase the buffer size. At the end, report the total number of bytes read. Open any other file with a larger size. Compare the number of bytes read as reported by your program with the size of the file listed with command ls -l.
Consult the resource about calculating the CRC32 value using library zlib. Open source crc32.cc. Compile and execute the program.
g++ =o crc32./ crc32 crc32 . cc =lz
This assignment applies if you are working on the transport protocol project, in a team of maximum two members. Only one team member should submit the assignment. Consult the appropriate document, if you wish to work on the messenger application. The following features are suggested in a particular order. You need not follow this order, but, for full marks, you must implement all the features listed. Please consult the marking scheme below.
Begin with the sender: start with the code you developed for Project Assignment 2 (PA2). Keep the two threads. First, modify the main function to handle the optional file parameter from the project documentation. Open the file for reading as a binary file.
Continue working on the sender. From the sender thread, read at most 512 bytes from the start of the file given as argument. Calculate the CRC32 value for the data read and output it.
Remove the CRC32 output from the sender thread and, using the code you developed for Project Assignment 1, assemble One valid data packet, and send it from the sender thread, to the destination and port given as command line arguments. Maintain the timeout protection available from PA2.
Use netcat to receive the packet and save it to a file. Use hexdump to examine the content of the file and to check that it looks ok.
Work on the receiver: start with the code you developed for Project Assignment 2. Modify the main function to handle the command line arguments for the receiver. In the receiver thread, open the file for writing, as binary.
Receive the data packet in the receiver thread and save the payload to the file. Test that the file received is intact by running diff between the file used as source (at sender) and the file saved by the receiver.
Add a simple global object that maintains the circular counter for sequence numbers. This will be used for both the sender and the receiver.
For the receiver, assemble a valid Ack packet, and send it to the sender. At the sender, add code to interpret the ACK packet. Verify that the ACK packet acknowledges the one data packet the sender is sending.
Finally, for both the sender and the receiver add loops to implement a simple alternating bit protocol for the transfer of a complete file from the sender to the receiver, assuming no errors occur. Do protect the transmission with timers, where necessary.
An archive containing the source code, including unit tests and an appropriate Make file a Project report that
(1) explains how the sender and receiver can be built
(2) provides evidence that the features listed in the marking scheme are correctly implemented. This evidence can be in the form of screen shots, etc.
5 pts The project compiles and generates two executable files, the sender and the receiver. Header unit tests should be incorporated from Project Assignment 1, and all tests should pass. Several files with different sizes can be transferred, correctly, between the sender and the receiver. No network errors or delays will be simulated.
2 pts Evidence that a data packet is correctly created is provided in the report.
1 pt Evidence that an ACK packet is correctly constructed at the receiver is provided in the report.
2 pt Evidence that a correct sequence of DATA and ACK segments is correctly exchanged, is provided in the report.