Write an application using Java programming language to implement a simple chat
ID: 3773575 • Letter: W
Question
Write an application using Java programming language to implement a simple chat system through socket programming using the following specifications.
1. The application is implemented using a module named “p2pchat”
2. The application uses TCP as the transport protocol.
3. The p2pchat module works as both client and server using multithreading to allow for sending and receiving at the same time.
4. When the p2pchat module starts using the command “p2pchat”, it listens on port “5789” for incoming connections on a separate thread (listening thread).
5. If the module starts using the command “p2pchat [ip-address]”, it performs the start procedure (i.e. listens on the 5789 port), and then initiates a connection with another p2pchat with the IP address given in the online command on a separate thread (sending thread).
6. When the user writes a text on any p2pchat peer and presses enter, the text message appears on the other p2pchat peer window.
7. Add the support for non-text chat to the p2pchat program e.g. sending a file, sending image, etc.
Explanation / Answer
I have uploaded the source code in the below link. Comment when download complete.
https://drive.google.com/file/d/0B9P4w87kevGhRUplVGU2Q2VqeHc/view?usp=sharing
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.