CPE 400/600 Computer Communication Networks

Fall 2013

Programming Project Phase 1: Messaging

Due on Sunday, October 27, at 11:59 pm


COSN: Cloud-based Online Social Network

Overview

The semester project will focus on the development of an Online Social Network. Online Social Networks, such as Facebook, Twitter, and Google+, are commonly deployed as client/server architectures and take advantage of content distribution networks. As privacy is becoming a major concern, we will develop a privacy protecting Cloud based Online Social Network in three phases.

In phase one we will implement a simple messaging platform based on the client-server model. Using transport layer protocols (i.e., TCP and UDP), we will develop chat and file sharing functionality.

In the second phase, we will develop cloud integration using commonly used free cloud storage providers such as Dropbox, Google drive, and Microsoft SkyDrive. Using transport and application layer protocols, we will develop a framework for profile registration as well as content storage and distribution.

In the third phase, we will address efficient content querying and delivery issues using peer-to-peer communication mechanisms and develop access control mechanisms to ensure user privacy.


Phase 1

In this phase you with learn to use the transport layer protocols (i.e., TCP and UDP) and client/server communication. We will implement a simple messaging and file exchange platform (similar to Napster).

The code that you develop in this part will serve as a basis for the following phases of the project. You must create a pair of programs (client and server). The server will act as a central registry for clients to lookup location of their friends. Clients will register with the central server when they become online. The server will keep a record of ID, IP, port for each online client. Queries to the server will be via UDP whereas communication between clients will be via TCP.

The server code should be started with a parameter of port number. Similarly, client code shold be started with parameters of user-ID, server-IP, and server-port (all seperated with spaces). After the client program is started it has to contact the server to indicate it is online and register it's TCP welcoming socket (which will be randomly chosen by the operating system).

Clients have to notify server when they terminate. However, if a client terminates abruptly, peers need to notify the server. The server will then drop the entry from the database.

After learning location (i.e., IP and port number) of a peer from the server, a client can establish a direct connection with the peer to chat or exchange files. For file exchange, users can ask list of current files and request files.

Message Formats

Following are the application level messages sent from/to the server using UDP sockets:

Following are the application level messages between the server and user using TCP sockets:

Following are the application level messages sent between users over the TCP sockets:

Note that, there is no space after each message.


Sample XML files

publicProfile.xml content.xml

Assumptions/Notes

Report all major actions as the program communicates with other server/users in a file named activity.log.

We assume file sizes to be at most 1M characters.

We assume user-IDs and file names to be at most 64 characters without any white space characters.

When a malformed message is received report it in a log file named error.log.

You may utilize localhost (127.0.0.1 or actual IP address) to test your program by running both server and clients on the same machine (with different port numbers).

You might get TCP messages in multiple segments even one byte at a time. Hence, you must check whether you have read all the message when parsing them (TCP streams).

Except file transfer, you should add end-of-line symbol ASCII LF '\n' to messages so that receiving TCP is able to know when a message is finished.

Deliverables

You must submit all the source code with sufficient comments to help understand the code.

You must include in your submission a file named README that includes your name and a brief description of your submission, including the name of each file submitted along with a one line description of what is in the file.

If your code is not complete, tell us what works and what doesn't. If you are submitting code that does not compile, please tell us that as well. If you borrow code from someone else, you are required to tell us about it (this must also be documented in the code itself).

Finally, feel free to include a description of any problems you had or anything else you think might be helpful to us.

Grading

You may work individually or with a partner. (No group of three or more is allowed).

Your project will be tested to make sure it works properly. We will test your clients and servers against each other. That is, your server should be able to exchange files with clients developed by someone else.

Your grade will depend on the functionality and the code quality. Hence, please pay careful attention to clean, modular and extensible design as you implement the project.

There will be bonus grades for extra functionality (in particular, mobile app or a well designed GUI) not required by the project (optional and at the discretion of the instructor) in addition to requirements marked as [bonus].

Remarks:

This document will evolve as we discuss the project and determine communication protocols and messaging formats.

See pages 159-161 of the text for udp socket and pages 164-167 for tcp socket examples in Python, http://docs.oracle.com/javase/tutorial/networking/sockets for Java, and http://www.faqs.org/faqs/unix-faq/socket/ for C. You may also look at http://www.cse.unr.edu/~mgunes/cpe401/cpe401sp09/Lecture18.ppt for threaded programming.

Last updated on Oct 29, 2013