Join: The registry will listen to a TCP socket at a known port. A new user will contact the registry at this port and register his/her username with a newly defined password. All the usernames should be unique. Each time a user wants to use the chatting system, he/she must contact the registry again, login with his username and password and indicate its presence. Then registry will know that the user is online and stores the IP address of the user. When the user want to leave the chatting system, he/she sends a 'LOGOUT' message to the registry and it appears as an offline user. In addition, the registry also listens to a UDP socket and every 60 seconds the user issues a 'HELLO' message to the UDP port of the registry. If the registry has not received a HELLO message from a user in 200 seconds, the user is removed from the list of online users.
Search: A
user looking for a peer to chat, contacts to the registry and searches
his/her username. The registry looks for
the name of the peer and returns the contact address of the user if
he/she is online. The registry also sends a 'NOT FOUND' message if
there is no user with the given username.
Chat: The user contacts the
requested peer
and sends a 'CHAT REQUEST' message. If the requested peer accepts,
he/she sends an 'OK' reply message and they start chatting. Otherwise
he/she sends a 'REJECT' message or a 'BUSY' message (if he/she is
already chatting with another peer).
You have to define details of your protocol. The user interface need not be sophisticated, but should be usable. It can be text-based or can be graphical. Your program should also provide log files which include all the messages sent and received by the peers and the registry.
Implementation
You can use any programming language of your choice (Java, Python, C, C++, etc). You should use only socket programming.
Do not use any sophisticated libraries downloaded from the web. You
will need to use multi-threaded server processes. Although we have
covered implementation of single threaded servers in the lecture, there
are tons of materials that you may refer for the description of
multi-threaded server implementation, and also it is expected that you
have some familiarity from the Operating Systems course.