This repository contains code for implementing Multi client chat Server.
The client should send the connection request to server.The server should reply client with appropriate messages if connection can be established or not.
If the connection can be established successfully,then generate appropriate identifiers for the client and store them at server.Identifiers includes Unique Id(5 Digit Random Number).After connection is established,send client the above details with a welcome message.
If the number of clients connected are already 5 then no further client is allowed to connect and server should inform client that “Connection Limit Exceeded !!”.
Keep the details in shared memory.Use synchronization while reading and writing into the memory.
Client should send a query message to server asking the details of online clients.Server should send the details of all the online clients [each with unique key].After receiving details, client can transfer messages to any other client of choice by using its unique id. (Note that this is a one to one communication).
Create another shared table which stores message details.
There can be a situation when a client A gets the list of online clients and before it can send any message to client B, client B goes offline.The sender in this case should be notified that client is now disconnected and that message should be discarded.
In order to disconnect, the client should send an EXIT message to the server.The server should notify all other clients with the details of client which is going to disconnect. Then terminate the client process.
Aclientshouldbeabletosendabroadcastmessagebytyping“/broadcast”.The message should be delivered to all clients connected to the server.5.GroupFormation:Inthispart,aclientshouldbeabletomakeagrouphavinguniqueidwithavailableactivemembers(max5inagroup).Twobasicparadigmsthathavetobeimplemented are:a.Withoutpermissionofothermembers:Theclientshouldbeabletomakeasimplegroupbytyping”/makegroup”followedbytheclientidsofallthemembersthattheadminwanttoincludeandthememberswillbeautomaticallyjoined(makingagroup in WhatsApp).b.Withpermissionofothermembers:Theclientshouldbeabletomakearequestofformingasimplegroupbytyping”/makegroupreq”followedbytheclientidsofallthemembersthattheadminwanttoinclude.Anotificationshouldbesenttothatspecificclientsaskingforpermissiontojointhegroup.Ifaparticularclientwantstojoin, then it may send “/joingroup” followed by group id as the response.6.Filetransfer:Inthispart,youhavetoemulatetheprocessofFTP.Theclientshouldbeable to transfer the files either personally or to a group.Functionalities to be included:1./active : To display all the available active clients that are connected to the server.2./send:Tosendmessagetotheclientcorrespondingtoits unique id.3./broadcast : Message should be broadcasted to all the active clients.4./makegroup...:Agroupwithuniqueidwillbemade including all the mentioned clients along with the admin client.5./sendgroup:Thesendershouldbeinthegrouptotransferthemessagetoallhispeersofthatgroup.Themessageshouldbesendtoallthepeers along with group info.6./activegroups:Todisplayallthegroupsthatarecurrentlyactiveonserverandthesender is a part of.7./makegroupreq...:Agrouphavinguniqueidshouldbemadewithcurrentlyonlytheadminclient.Therequestmessageforjoiningthegroupshouldbenotifiedtoallthespecifiedclients.Clientscanrespondto join that group.8./joingroup:Ifthismessageissentbyaclienthavingtherequestforjoining the group, then he will be added to group immediately. 9./quit:Theclientwillberemovedfromtheserver.Thisclientwillberemovedfromall the active groups.10./activeallgroups : To display all the groups which are active on the server.11./joingroup:Ifthismessageissentbyaclienthavingtherequestforjoiningthegroup,thenhewillbeaddedtogroupimmediately.Otherwisearequestshouldbepassedtotheadminofthatgroupandifadminrespondstotherequestpositively then he should be joined to that group.12./sendfile<client_id>:Thefileshouldbetransferredfromoneclienttoanotherviaserver.Toimplementthispart,filehastobeuploadedtoserverandthenthefileshouldbedownloadedtotherespectiveclientandshouldbetransparent to all the clients.13./sendfile<group_id>:Thefileshouldbetransferredtoallthe members of that group.