Published using Google Docs
Project 0 Specification
Updated automatically every 5 minutes

CSE 486/586 Distributed Systems Project 0

Simple Messenger on Android

Introduction

In this assignment, you will design a simple messenger app on Android. The goal of this app is simple: enabling two Android devices to send messages to each other. The purpose of this assignment is to help you understand some of the basic mechanisms necessary to write networked apps on Android. It is intended to be simple, just to get you familiarized with Android.

Still, please start this assignment as soon as possible. There will be some learning curve in terms of socket programming as well as Android programming. While the teaching staff do not think that these are difficult subjects to learn by yourself, if you have not done these before, we cannot tell you how much time it will take for you to acquire the basics. So again, please start this assignment as soon as possible.

Step 1: Installation (Eclipse & Android SDK)

The first thing you need to do is to install Eclipse and the Android SDK on your machine. Follow the procedure described at http://developer.android.com/sdk and you should be able to install it.

Step 2: Reading the Android Dev Guide

The Android Developer’s Guide at http://developer.android.com/guide/index.html is a great source of information for starters as well as experts.

Please read at least the articles listed below. However, please keep in mind that, depending on your background, not everything might make sense immediately. This is probably natural for people who didn’t take a networking course or an OS course before (especially, we didn’t cover processes and threads in class, so the article about them might be difficult to read). If this happens to you, don’t panic and move on; later, post a question on Piazza or ask the teaching staff during our office hours.

A critical part of any development is testing and debugging. Especially for this assignment, you need to test your app with two emulator instances. The following two articles describe this well:

Step 3: Following Tutorials

The Android Developer’s Guide also has great tutorials you can follow. These tutorials will teach you the basics. Please do the following two tutorials at least:

Step 4: Writing the Messenger App

The final step is writing the messenger app. The following are the requirements:

There are a few things to note:

Interconnecting Two Emulator Instances

Although the Android Dev Guide describes how to interconnect two instances (http://developer.android.com/guide/developing/devices/emulator.html#connecting), it only describes it for a one-way client-server scenario. If your implementation only has one device acting as a server and the other device acting as a client, the link is probably good for you. However, if your app acts both as a server and as a client on a single device, you need to set up both ways, which is not covered in the above link. Please follow the rest if you want to set up both ways.

Again, what we mean by “server” below is really a piece of code (either a complete program or a block of code inside of a program) that opens a server socket and listens on it. Likewise, what we mean by “client” below is really a piece of code that opens a client socket and connects to some other server sockets.

To allow one emulator instance to communicate with another, you must set up the necessary network redirections as illustrated below.

Assume that your environment is

Here is how you could set it up:

  1. Set up the server on B, listening to 10.0.2.15:<serverPort1>
  2. On B's console, set up a redirection from A:localhost:<localPort1> to B:10.0.2.15:<serverPort1>
  3. On C, have the client connect to 10.0.2.2:<localPort1>

For example, if you wanted to run an HTTP server, you can select <serverPort1> as 80 and <localPort1> as 8080:

In addition,

  1. Set up the server on C, listening to 10.0.2.15:<serverPort1> (this doesn't have to be different from B's <serverPort1>)
  2. On C's console, set up a redirection from A:localhost:<localPort2> to C:10.0.2.15:<serverPort1> (notice localPort2, which should be different from localPort1 that B uses.)
  3. On B, have the client connect to 10.0.2.2:<localPort2>

For example, if you wanted to run an HTTP server on C, you can select <serverPort1> as 80 and <localPort2> as 8081:

Useful Hints

Project Group

This assignment should be done individually. This includes both the design document and code. There should be no project group for this assignment.

Design Document

You need to write a design document of up to 2 pages (12 pt font in .pdf). This should include:

  1. What components you designed and what they do
  2. The protocol between two devices
  3. Difficulties you faced (what things took time to figure out, …)
  4. (Rough) # of hours you put
  5. How to test your app
  1. What port numbers to use
  2. How to set up redirections in order to test your app properly
  3. Any other special instructions for testing

Please include figures if necessary.

Submission

We use the CSE submit script. You need to use either “submit_cse486” or “submit_cse586”, depending on your registration status. If you haven’t used it, the instructions on how to use it is here: https://wiki.cse.buffalo.edu/services/content/submit-script

You need to submit the following three files:

Deadline: 2/6/12 (Monday) 2:59pm

This is right before class @ 3pm. The deadline is firm; if your timestamp is 3pm, it is a late submission.

Grading

This assignment is 5% of your final grade. The break-down for this assignment is:

Late Submission Policy

Academic Integrity