Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit



CSCI 4220 Lab 9


Lab 9: Socket Options

This lab should be fairly brief. You may want to adapt an existing program, but keep in mind that no calls to functions like read() or write() will be used. You may need to include <netinet/tcp.h> for some options.


If you do have the textbook, you can find socket option descriptions in Section 7.2 (page 193). You can find descriptions in man 7 socket , man 7 tcp , and man 7 ip if you don’t have your textbook. You can also check the link from slide 2 of Lecture 17.


Write a C program that takes a single argument, the IP address of a host. Print to standard output what the MSS (maxium segment size) and receive buffer size (in bytes) are before connecting to the provided IP address. Once you have printed these values, call connect() on TCP port 80, print the MSS and receive buffer size of the socket to standard output, and then call close() before terminating your program.


Since many of you are on Windows and these values may not be exposed, you should submit your program (after testing it compiles locally) to the “Lab 9” gradable on Submitty. The Submitty points are not real and will not be applied to your grade. The gradable expects a single .c file but doesn’t care what the name of it is. It will not look for a Makefile. The unp.h file will be available in the same directory you submit your .c file to, just like in Assignments 1 and 2.


Also submit a single README.txt file that states the MSS and receive window values before and after connecting for each case, and explain why these values did or didn’t change, and why they might be different for the different IP addresses that were tested. If you get different results on your local machine, feel free to include them - particularly depending on your operating system you may see different results.


If you haven’t done so, please take a minute to log onto AEFIS and do your course evaluation survey for Net Prog! All feedback will be anonymous but I do read it, and both I and the department appreciate you taking the time even if you have no comments to add.