COSC 6377 - Computer Networks

Fall 2012

MW 1:00-2:30pm at PGH376

InstructorOmprakash Gnawali

Project - 2

Due: December 5, 2012

Faster File Transfer Using Wireless Access Point Selection

In this project, we will learn how to monitor the performance of wireless links through various access points (AP) available at a place, associate with the AP that offers the highest link capacity, and transfer a large file. Such AP selection will allow us to transfer large file over wireless network quickly, especially in a wireless network in which link quality changes due to node mobility, interference, obstruction, etc.

You are welcome to use an approach different from the one described in this writeup. The only requirement is your project should compile and execute on bayou.

Manual Access Point Selection

We will learn how to manually select the best performing link before we automate access point selection.

We will use NetworkManager software as a base on which we do our project. NetworkManager is a set of libraries and example programs that allow us to perform various network management functions such as scanning for wireless access points and associating with a specific access point.

To get started, download the latest version of NetworkManager code (using git clone command) from this link:

Compile the code in your system. You might have to install several other packages for you to successfully compile the code.

Find the command line tool (under the directory cli) and learn how to use the command line tool to list and connect to a specific access point with a given SSID. When you are on campus, you might be able to see tens of access points with the SSID UHWireless. Your first task is to list all the access points with that SSID. Your second task is to learn how to connect to one of the access points (the one you decide) with that SSID. Verify that you are able to connect to the Internet once you associate with a specific AP.

Now we know how to connect to a specific AP, we learn how to make an informed decision on which AP to connect to. We want to connect to the AP that provides the best download rates from the Internet. We will use a tool called iperf to measure the download rate of a link through a given AP. We are assuming that the link between the AP and your laptop is the bottleneck. Iperf is already installed on bayou. Install iperf on your laptop. Then run iperf in server mode on bayou listening on a port that was assigned to you. Run iperf on your laptop to measure the rate at which you can transfer data between your laptop and bayou through the AP to which you are associated. You should learn the iperf option that allows you to run the measurement for a fixed time, e.g., 5 seconds, and using UDP.

Once you complete the above two tasks, you know how to manually find out which AP gives you the best data rates and associate with that AP.

Automating Access Point Selection

Automating the above manual steps is easy if you are willing to live with quick and dirty hacks. The first step is understanding the code in NetworkManager that scans and lists all the access points. You can start with the file called get-ap-info-libnm-glib.c. Insert as many printfs as you need in the code. Then compile and run the program to understand how the code works. You will learn that the program loops through all the WiFi interfaces and displays information about them. You need to change the code so that it associates with each AP with the right SSID and performs the iperf test. You may launch external executables to accomplish these tasks. You can have external programs redirect their output to known files so that the main program may know the result of execution. Once your program has gone through all the APs, your program should know the AP that offers the best data rate. You may now launch another external executable to associate with the "best" AP.

File Transfer

Start with your code for HW1. In HW1 you wrote a socket client and server to transfer files. We need to make a few changes to make your client and server perform better in a dynamic wireless environment.

It is not sufficient to find the best AP in the beginning of file transfer, especially if the file is large. The file transfer may take a long time and during the transfer better links might be avaialble or the selected link might get worse than the other links that are avaialble. Your file transfer system should periodically re-assess the data rates available through the different APs. It could also re-assess based on certain triggers (e.g., the data rate goes below 50% the measured rate).

When you perform data rate assessment by connecting to different APs, the TCP connection between your client and server, and hence the file transfer between them, terminates. You do not want to restart the file transfer from the first byte. You want to resume the file transfer where it stopped due to data rate assessment or your decision to switch to a different AP. You are welcome to come up with elaborate protocol to keep track of the bytes that have been transmitted, received, and acknowledged, much like what TCP does. An easier alternative might be for the server to fragment the file into fixed sized chunks. The server could tell the client how many chunks there are before the file transfer starts. Then the client simply fetches all the chunks, one at a time. The chunk size should be granular enough to allow sufficient number of link assessments in the middle of the file transfer. A few MB is probably a good chunk size.

The client may perform link measurements and new AP associations once every n chunks. The assessment and AP association may be integrated into your client/server code, or may be done by launching external executables. When the client finishes downloading all the chunks, it concatenates all the chunks into a single file.

Testing Your Project

We will test your project by making your client and server transfer a file that is at least 200 MB in size. The command will be identical to what we used for HW1:
./file_server listen_port

./file_client server_ip server_port serverfilename savefilename

Please read through HW1 description if you don't remember how file_server and file_client are supposed to work. We will launch file_client on a laptop with wireless interface and file_server on bayou.

During the last two weeks of the project, we will make three APs avaialble with the SSID COSC6377P2. The APs will be programmed to change the data rate avaialble through them from low to medium to high at fixed intervals. If your file transfer system performs proper AP selection, you should achieve an effective data rate close to "high". Without AP selection, you will achieve a rate close to "medium". The worst case performance, due to buggy AP selection, could be close to "slow".

When we test your project, we will manually (at unpredictable interval) change the rates offered through the APs and we expect your file transfer system to select the best AP at any given time.

Project Submission

Put your source code into a folder with the name: uhid_p2, where uhid is the prefix of your email address. There should be a single Makefile in that directory. When we run make on that directory, it should produce two executables: server and client. Put a README.txt in the directory describing anything unusual (e.g., limitations) of your implementation. Then, zip the directory and upload the zip file using Blackboard.