In the 3rd phase, you will integrate functionality from Phase 1 and Phase 2 to develop the communication backbone of the Cloud-based Online Social Network.
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.
Note that, file upload is through cloud API whereas file download is through HTTP.
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 for later use . 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.
Note that, friendship is established once and the database helps to locate friends in subsequent session of the application.
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.
Note that, Similar to FTP, you need user level commands and protocol level messages. We have not specified user level commands and you can tailor them to differentiate between friends in sending/receiving chat messages.
In addition to getting files from cloud, a user might get files from an online friend. In particular, when a user is posting new content, he/she should send a notification to all online friends and provide a copy of the file when requested.
UPDATE profile-version XML-length XML-message
This command notifies profile update to friends where XML-message is the new addition to the content.xml file. Receiving person should append this to the file they have in their cache.
This command queries a posted file which is referenced in the XML file transmitted in an earlier UPDATE message. (This message will be automatically sent if UPDATE has a file)
FILE file-name file-length file-content
This command sends a posted picture or video in response to a
GET message. If the requested file does not exist the reply will have a file-length of 0 and no file-content.
Note that, even though files will be upload to cloud, we will directly send files to online friends over the existing TCP session.
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 gets 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 indicate their contribution to the project in the comment section.
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 Dec 3, 2013