{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Lab 07: The Internet\n", "\n", "- **Name**: Domer McDomerson\n", "- **Netid**: dmcdomer" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Activity 1: SpeedTest\n", "\n", "For the first activity, you are to measure the speed of various networking technologies by using the [SpeedTest] website. You are to use the following three connection types:\n", "\n", "1. **Wired connection from your laptop or a lab machine**\n", "\n", "2. **Wireless connection from your laptop**\n", "\n", "3. **Cellular connection from your phone (make sure you are using 4G/LTE and not WiFi)**\n", "\n", "\n", "To test the speed of each connection, simply go to the website on the appropriate device: www.speedtest.net and hit the `Go` button. This will measure your **Ping**, **Download**, and **Upload** speeds to generate a result such as:\n", "\n", "\n", "\n", "\n", "[SpeedTest]: https://www.speedtest.net/" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Speed Tests\n", "\n", "Run the [SpeedTest] on each connection type a few times to get a representative sample and then complete the table below:\n", "\n", "| Connection Type | Ping (ms) | Download (Mbps) | Upload (Mbps) |\n", "|-----------------|-----------|-----------------|---------------|\n", "| Wireless | 0 | 0 | 0 |\n", "| Wired | 0 | 0 | 0 |\n", "| Cellular | 0 | 0 | 0 |\n", "\n", "
Complete Table
\n", "\n", "[SpeedTest]: https://www.speedtest.net/" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Analysis\n", "\n", "After completing the table above with your speed tests, analyze the results by answering the following questions:\n", "\n", "1. Which connection type had the best **latency**? Explain.\n", "\n", " Response Here\n", "\n", "2. Which connection type had the best **bandwidth**? Explain.\n", "\n", " Response Here\n", " \n", "3. What difference (if any) did you notice between **download** and **upload** speeds? Discuss why this could be.\n", " \n", " Response Here\n", "\n", "4. Overall, which connection type was the **best**? Explain.\n", "\n", " Response Here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Activity 2: Bandwidth and Latency\n", "\n", "For the second activity, you are to write two functions that you can utilize to perform your own **bandwidth** and **latency** measurements. The first is `measure_bandwidth`, which uses [requests] to download data from a web server, while the second is `measure_latency` which uses a low-level [socket] to connect to a remote server. For timing, we will use Python's [time] module:\n", "\n", " current_time = time.time()\n", "\n", "[requests]: http://docs.python-requests.org/en/master/\n", "[socket]: https://docs.python.org/3/library/socket.html\n", "[time]: https://docs.python.org/3/library/time.html" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Measure Bandwidth" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import requests\n", "import time\n", "\n", "def measure_bandwidth(url):\n", " ''' Measure bandwidth by doing the following:\n", " \n", " 1. Record start time.\n", " 2. Download data specified by url.\n", " 3. Record end time.\n", " 4. Compute bandwidth:\n", " \n", " bandwidth = (Amount of Data / Elapsed Time) / 2**20\n", " '''\n", " return 0" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "URLS = {\n", " 'Discord': 'https://downloads.slack-edge.com/releases_x64/SlackSetup.exe',\n", " 'Slack' : 'https://dl.discordapp.net/apps/win/0.0.305/DiscordSetup.exe',\n", " 'Firefox': 'https://download-installer.cdn.mozilla.net/pub/firefox/releases/66.0/linux-x86_64/en-US/firefox-66.0.tar.bz2'\n", "}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Measure Latency" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import socket\n", "import time\n", "\n", "def measure_latency(domain):\n", " ''' Measure latency by doing the following:\n", " \n", " 1. Create streaming internet socket.\n", " 2. Record start time.\n", " 3. Connect to specified domain at port 80.\n", " 4. Record end time.\n", " 5. Compute latency:\n", " \n", " latency = Elapsed Time * 1000\n", " '''\n", " return 0" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "DOMAINS = [\n", " 'facebook.com',\n", " 'cnn.com',\n", " 'google.com',\n", " 'nd.edu',\n", " 'amazon.co.uk',\n", " 'baidu.com',\n", " 'europa.eu',\n", " 'yahoo.co.jp',\n", "]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Analysis\n", "\n", "After writing the `measure_bandwidth` and `measure_latency` functions above and testing them, answer the following questions:\n", "\n", "1. Which applications had the best bandwidth? How do these bandwidth measurements compare to the ones you had in Activity 1? What explains the differences?\n", "\n", " Response Here\n", "\n", "2. Which domains had the best latency? Which ones had the worst latency? What explains these differences?\n", "\n", " Response Here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Activity 3: EggHead's Adventure\n", "\n", "For the last activity, you are play the following educational game created by the [Office of Digital Learning] as an experiment:\n", "\n", "- [Introduction to Networks](https://s3.us-east-2.amazonaws.com/cs4all/cs4all-game/story_html5.html)\n", "\n", "- [Network Toolkit](https://s3.us-east-2.amazonaws.com/cs4all/Network-toolkit/story_html5.html)\n", "\n", "Once you have completed the game, please fill out the following [survey](https://goo.gl/forms/AfUJ5b4cQfVqwCof1).\n", "\n", "[Office of Digital Learning]: https://online.nd.edu/" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python3", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.8" } }, "nbformat": 4, "nbformat_minor": 2 }