Anda di halaman 1dari 3

EEE13MachineProblem2

GroupChat

The group chat is a popular means of communication over the internet. It has made
communication between people separated by distance much easier, thus unifying all people
within our nation, denouncing the evil of truth and love, and extending our reach to the stars
above.#hugot#teamrocket

Your task is to create a chat server using TCP that will accept connections from
terminal clients. The server is in charge of creating and maintaining accounts, giving users
access to the chat,andupdating the chat window when users send messages or log in and
out.

Using the chat client, the user should be able to log into an existing account on the
server (or create one if it doesnt exist), and send and receive messages from other
connectedusers.

Thefollowingfeaturesshouldbeimplemented:
connecttoaserver(ip,port)whichisassumedtobeon
accountcreation
login
timestampofwhenmessagewassent
timestampofwhenuserloggedin/out(canbeseenbyothers)
commandthatprintswhoisonline

CommandstoSupport:
ConnectingtoServer(client):
clientshouldconnecttotheserverusingcommandlinearguments
canconnecttoserverusingcomputersconnectedtolocalnetwork
eg../client<ip_address><port>

LoggingIn/CreateAccount(client):
uponconnectingtoserver,clientshouldpromptuserwithamessagelike1
Login/2CreateAccount
entering1shouldallowusertologinwithusernameandpassword
typingpasswordsshouldshowasterisksinsteadofbeingblank
servershoulddoublecheckiftheaccountexists,shouldnotletuserjoin
thechatiftheaccountisnotvalid
entering2shouldallowusertocreateanaccountwithauniqueusername
andpassword
typingpasswordsshouldshowasterisksinsteadofbeingblank

theusershouldbepromptedtwiceforthepassword,andtheclientor
servershouldensurethatbothpasswordfieldsmatch
thelogincredentialsshouldbesavedintheserver(MySQL/SQLite3
databasenotrequired,butisabonus)
erroneouscommandsshouldbehandled
blankusernamesandblankpasswordsarenotallowed
ifloginissuccessful,amessagesimilarto<timestamp>:<username>has
enteredchatshouldbebroadcastedtoallotherusers
(bonus)passwordshouldbehashedbytheclientthehashingfunctionshould
beatleastascomplexasanMD5hash,notsomethinglikeROT13

Messaging(client):
COMMAND:<message>
limitof140characters
messageshouldbebroadcastedtoallusers(similarto<timestamp>:
<username>:<message>)

WhoIsOnline(client):
COMMAND:/whosonline
servershouldsendthelistofonlineuserstotheclientthatrequesteditonly

LoggingOut(client):
COMMAND:<Ctrl+Csignal>
thereshouldbeasignalhandlerforCtrl+C
servershouldbroadcastthattheuserhasloggedout(similarto<timestamp>:
<username>hasloggedout)

ChatRoomTermination(server):
pressingCtrl+Cshouldinitiateterminationoftheserver
beforetheserverexits,itshouldbroadcastamessagetellingtheclientsto
disconnect
serverwillonlyterminatewhenallclientshaveloggedout

PrivateMessage(bonus):
COMMAND:/PM<username><message>
sendsamessagetothatuseronly

Allmessagesfromtheservershouldbeaccompaniedbyatimestampofwhentheevent
happened(ie.whentheclientsentthemessage,whentheclientloggedin/out).Youcan
defineyourownprotocolforthismachineproblem,however,anextrabonuswillbegrantedif
yourclient/servercancommunicatewiththeclient/serverofotherpeople.

Grading:
Thismachineproblemistobedoneindividually.Copyingofcodefromotherpeopleis
prohibited.Codesnippetstakenonlineshouldbeproperlycitedincodeandindocumentation.

Connectatoserver(5%)
printswhichIPisconnected/disconnected
Createaccount(15%)
Savingaccountinaserverfile/database(10%)
Uniqueusernamechecking(2%)
Passwordmatchchecking(3%)
Login(5%)
Chatproper(40%)
Login/outnotification(5%)
Messagetimestamps(5%)

Messagesendingandtruncation(20%)
Logoutfunction(10%)(usingCtrl+Csignal)
Terminateserver(10%)
Displaywhoisonlinecommand(15%)
Documentation(10%)
Bonus(20%)
Hashing(5%)
Privatemessaging(5%)
SQLdatabaseforlogindata(5%)
Cancommunicatewithprogramofotherclassmatesproperly(5%)

Anda mungkin juga menyukai