In the 2nd phase, you will learn to use application layer protocols (i.e., HTTP and SMTP) as well as interaction with cloud storage services. We will remove the central server in Phase 1 and implement its functionality through distributed cloud resources. Additionally, we will add more social interaction.
You must select a free cloud service provider (such as Dropbox, Google Drive, Micrsoft SkyDrive) and integrate its remote file operations into your code. For students working in pairs, each team member must implement a different cloud provider. The cloud provider will be used for peer address resolution and content distribution.
Each peer must have its own cloud storage account to host their profile.
Connectivity is established through a location "look up" file location.xml that contains the peer's current internet address and port number and links to publicProfile.xml and content.xml documents. The location file will hold the address and port number of of the peer's TCP service, which must be updated promptly when the peer's network state changes. When the peer terminates, the address must be set to 0.0.0.0 and the port number to 0. to indicate off-line status.
A public profile publicProfile.xml will contain basic information about the user.
A peer will have the ability to upload social content similar to MySpace walls through the cloud service. A registry of all posted content content.xml will contain version number, tags, content type, upload time, URL, and info. When new content is posted to the cloud, a link to the content will be added to the registry file content.xml with an incrementing profile version. When a peer accesses another peer's profile, the accessing peer must parse the content.xml registry, and automatically download all new content.
When one peer initiates a friend request that peer must send an e-mail message, which contains the link to the profile in his own cloud storage, through SMTP. The receiving friend must pull the IP address and port number from the indicated cloud provider, and initiate a TCP connection with the initial user. The friendship is confirmed when the receiving friend sends a message containing a link to their own profile. The sending of the friend request e-mail must be done programmatically through SMTP, but reading may be done through a user-agent (e.g. web browser, outlook).
1. Initial friendship request will be sent over an email using SNMP protocol. For this you may use standard libraries (linked below). The email will contain the URL for user's location.xml file stored in the cloud.
2. Receiving user will use their email client and copy the URL for location.xml file and parse it into the program which will establish TCP connection to the indicated address. The program will store the URL in its database. Once TCP is established, the client will send "
FRIEND user-C2 URL" where URL is the location.xml file of the 2nd user.
3. Finally, user-1, will acknowledge the message with "
CONFIRM user-C1" and store the link in its database.
For this phase, the peer's TCP service must support multi-chat, (e.g. while Alice is chatting with Bob she gets a chat request from Chris; an additional chat session starts with Chris.)
CHAT counter message
A chat exchange between users with a counter that increments. Message can be up to 1024 characters and will be displayed to the user. Messages with end-of-line characters should be sent as a separate
This message indicates
CHAT message with
counter is delivered to the user and is sent automatically.
This command ends the current chat session and related socket connection.
You must have an account with the cloud storage service and register a development application to be able to use their respective APIs. To use the cloud APIs a client must obtain an authentication token by using the Oauth protocol.
Report all major actions as the program communicates with other server/users in a file named
We assume user-IDs to be at most 64 characters without any white space characters.
When a malformed message is received report it in a log file named
You may utilize localhost (127.0.0.1 or actual IP address) to test your program by running multiple users on the same machine but within different folders (with different port numbers).
If testing on multiple machines, be sure that the machines are not behind a NAT (or within the same subnet).
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. At the receiving end, the application should read from the socket until it sees the ASCII LF '\n' symbol.
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.
You may work individually or with a partner (No group of three or more is allowed). If working with a partner, two cloud storage services must be used, and each user should submit a document indicating their contribution to the project.
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).
This document will evolve as we discuss the project and determine communication protocols and messaging formats.
The SDK's for the cloud storage providers may be used. In addition, the libcurl may be used for HTTP and SMTP in C, as well as the standard Python and Java Libraries, but no other third party software may be used.
Don't wait till the last minute to start this phase!
Last updated on Nov 18, 2013