Internet Chat Application
CNT5106 Computer Networks : Internet Chat Application
Created by: Avinash Iyer and Suyog Daga
This is an Internet Chat Application developed in Java language, using Eclipse IDE.
We have used a Client - Server Model, where a client interacts with another client via server. A client can send a file or message to another client.
Overall outline for project:
- Broadcasting message to all clients.
- Unicast a message to particular client.
- Blockcast a message to all clients except for the specified client.
- Broadcast a file to all clients.
- Unicast a file to particular client.
File Structure: We have created 4 classes :
- Client: Client class implementation
- Server : Server class implementation
- MessageType : Assists server for parsing messages and sending Broadcast, Unicast and Blockcast messages from Server respectively.
- FileHelper : Assists server for parsing file address and then Broadcasting and Unicasting the file from Server respectively.
How to use files:
-
Root directory for project is "com/cn" because this is the main package structure. All files ie Server, Client, FileHelper and MessageType classes belong in "com/cn" directory. For eg:- if current directory on your machine is "C:\Users\Desktop", then file structure for Server.java should be "C:\Users\Desktop\com\cn\Server.java".
-
Before compiling ensure that you are in a folder above com/cn. For example, if directory structure is "C:\Users\com\cn", then navigate to "C:\Users" and then, Server and Client classes should be compiled and run as follows: i) Server - javac com/cn/Server.java java com/cn/Server ii)Client - javac com/cn/Client.java - java com/cn/Client clientname (Here clientname should be like client1, client2 etc , and should be named in the order in which they connect to Server. For example, 'client1' should be first to connect followed by 'client 2' and so on.)
-
Open instances of command prompt and perform the above compilations to run Server and Client classes. Find below examples of how to execute the various operations: Messages:- i) Broadcasting message - broadcast message "message1" . This will send message to all clients except sending client. ii) Unicast message - unicast message "message1" client2 .This will send message to only client2 from sending client. iii) Blockcast message - blockcast message "message1" client2. This will send message to all clients except client2 and sending client.
Files:- iv) Broadcasting file - broadcast file "C:\Users\Desktop\abc.txt". - This will send file 'abc.txt' to all clients except sending client. 'abc.txt' will be copied to receiving client's respective folder, which would be created in 'com/cn' automatically. v)Unicast file - unicast file "C:\Users\Desktop\abc.txt" client2 . - This will send file 'abc.txt' to client2 only.
-
For sending files, folders for respective clients will be created automatically if they do not exist.
NOTE:-
- Root directory (com/cn) is strictly required. (Refer screenshots in README.docx file for any help).
- Clients should be named in the order in which they connect. Eg:- first client connecting should be named "client1".
- Client cannot send message or file to itself.
- Port is fixed at 8000.
For any questions, please e-mail us at i) avinashiyer4292@ufl.edu ii) suyogdaga@ufl.edu