



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The extension of a chat server project to include multiple servers with peer-to-peer communication and server discovery protocol using multicast messages. Servers communicate with each other and prevent name collisions. The document also covers server-to-server and user-to-server communication, failure detection, and user search.
Typology: Study Guides, Projects, Research
1 / 6
This page cannot be seen from the preview
Don't miss anything!




Document Version 1.
Aranika Mahajan - 31095373 Manu Sethi - 10317465 Rohin Sethi - 97173206 Twisha Patel - 05499574
In this project, we would extend the earlier scenario of Projects 1 & 2, to include multiple chat servers.
Fig: Representation of Chat Servers and Clients
The circles in the above diagram represents chat servers implemented in project 2. The square elements represent the user nodes connected to the servers. Each user node consists of user agent as well as end user modules developed in project 2. In project 2, peer-to-peer communication was disabled, which will be re-enabled in project 3. Also the servers will have the capability to communicate with each other.
Nodes will be named hierarchically in a globally unique fashion. The format is as follows:
Global Name=
Hence Name collision is automatically prevented.
This project will be divided into various modules as follows: -
Handling Server Name Collision
Checkservername
Myname
On receiving this reply, the server asks the user to enter another name and again multicasts that name using the above command.
Confirmname
If again no reply is received till Timeout then the server sets this name as its own name.
Server Discovery
As part of server discovery, we would use the random number concept. Every time a new server comes up, it would generate a random number from a particular range and hence generate a ConnectID. Then it would send a multicast message to all the other servers with a connect token and this ConnectID. Also, any other server which is not connected to the max number of neighbors would also generate a random number every X seconds. All the servers with the same ConnectID would reply back to this new server with a connect reply token (unicasting). The new server would acknowledge this connect reply to the max number of neighbors with a final connect token on first come first serve basis and to the others who had replied with a deny token. If no server replies to this new server, it would wait X seconds before it re-generates another random number and sends out the multicast message again.
Since all nodes will after some interval of time be connected to max no of nodes, hence the probability of fragmentation of the network is very low. Even if a node crashes and fragments the network, its neighbors will, in some time, connect to each other and hence join the network back again.
No of servers say 20 Let max number of neighbors be N (Preferably 4). Range of random numbers R = 1 to No. of Servers / N Random Number Generation after every X Sec (Pref. 300 Secs)
The purpose of sending to all neighbors is, that if any server lying along the path through which the message had come fails, then in that case other neighbors would be able to send the reply via some other path.
Failure Detection
A Thread in each End User would continuously ping the server, and when it does not receive any response it assumes that the server has gone down and goes into Failure Recovery Mode.
Load Balancing and Failure Recovery
Whenever a new user comes up, we need to assign a backup server to it. For this when a user- agent comes up, we give it a number out of N in a circular sequence (N is the number of max neighbors), where each number refers to a neighbor in the neighbor list. We give a number and not a name because the list of neighbors is dynamic due to node failures and continuous reconnections.
In case of failure, the child sends a message to the backup server corresponding to the BackupID it was assigned in the neighbor list. If it doesnโt receive a reply from the backup server, it increments the backupID in a circular loop till it has tried all neighbors. If there is no reply at all, this child node dies.
Request : Adopt
Search for another End User
If an end user needs to search for another end user under some other server, it sends a message to itโs own server. The server sends it out to itโs neighbors to search for that user. The timeout in this case will be doubled than the usual timeout time. In case that user is found, the Server sends a reply to this message to the end user.
Request : Search
The list of commands is as follows: -
1. Check Server Name Collision 1. Server multicasts the following command: - Checkservername
Server 1
Server 2
Server Server^4 3
1(mcast)
1(mcast)
2 (unicast)
1(mcast)