build details

Show: section status errors & todos local changes recent changes last change in-page changes feedback controls

Part 2: Networking

Modified 2020-10-08 by sageshoyu

Netcat (20 points)

Modified 2020-10-08 by sageshoyu

The command nc is short for “netcat” and is similar to cat but works over network connections. It reads from standard input and writes its contents not to standard output, but to a specified server. Write your answers in the corresponding sections of networking.txt.

  1. Point nc to google.com as follows: nc www.google.com 80 When you first connect, it will be silent. Then type any arbitrary text and press enter. What is the error number?

  2. Now type some valid http into nc: GET / HTTP/1.1. What is the output?

  3. Now use nc to make a server. In one window, type nc -l 12345. This will cause nc to listen on port 12345. In another terminal on the same machine, type nc localhost 12345. You can type a message in one window and it will appear in the other window (and vice versa). This trick can be very useful to test basic internet connectivity - if the client and server can send packets at all. No answer is required for this question.

  4. By convention, roscore listens on port 11311. Try using nc to connect to port 11311 on a machine where roscore is running, such as the Pi on your drone. What protocol is roscore using to communicate (think transport layer)?

Talking to Your Robot (10 points)

Modified 2020-10-08 by sageshoyu

So far, this assignment has required access to localhost, the local machine you are connected to, and google.com.

Most commonly, the base station and robot are connected over TCP/IP to the same local network. Then you can look up your machine’s IP address (ifconfig in Unix; other ways in other OSes), and your robot’s IP address, and connect them. How can you find your robot’s IP address? Well it’s a chicken-and-egg problem. If you knew the IP address, you can connect to the robot and run ifconfig and find the IP address, but you don’t know the IP address.

What to do? There are several solutions. Write the answers to the following questions in networking.txt.

  1. Brainstorm how you can solve the chicken-and-egg program to connect to your robot. List three different solutions.

Look Ma, No Internet! (10 points)

Modified 2020-10-08 by sageshoyu

But what about if there is no public internet connection? What if you want to fly your drone in the wilderness? Well, there does exist cellular modems and satellite connections, but you can also tell your drone to act as a Wifi Hotspot. It can create a network and run a DHCP server. You can configure this on your drone using the file /etc/hostapd/hostapd.conf. Then you can connect your laptop’s base station using the SSID and passphrase specified in that file, and connect to the drone.

Alternatively you can set up your laptop as the Wifi base station and configure the drone to connect to its network. The details will vary depending on your laptop OS and settings.

Your Pi is configured to be a Wireless AP Master by default. Connect to it with your base station. Write the answers to the following questions in networking.txt.

  1. Which machine is acting as the DHCP server?
  2. What is the Pi’s IP address? What is yours?
  3. Describe another network configuration for the wifi, other than the Pi being a Wireless AP Master.
  4. Describe three network configurations for a network allowing a basestation and PiDrone to communicate with each other. Feel free to add additional devices, such as a cell phone performing internet connection sharing.

Handin

Modified 2020-10-08 by sageshoyu

When you are done, use this link to create your assignment Github Repo.

Repo should include:

  • hello1.py, hello2.py, hello.sh, my_cat.py, my_reverse_sort.py, my_sort_status.py
  • shell.txt, networking.txt