Skip to content

A private chatroom that 2+ devices can share over WiFi.

Notifications You must be signed in to change notification settings

aaroncorona/Group-Chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Group Chat

GitHub commit activity

💬 Overview

A private groupchat that 2+ devices can share over WiFi.

📖 Table of Contents

⚙️ Tech Stack

  • Java
  • IntelliJ

🗂️ File Descriptions

  • Client.java - Establishes a client socket, which is composed of 2 sockets (1 to send files, 1 to send text). Also, creates a chat GUI.
  • FileHandler.java - Reads a file over a particular socket. The server runs this as a thread for each client.
  • ChatHandler.java - Reads text continually over a particular socket until the socket is closed. Also, relays each message back to all the clients. The server runs this as a thread for each client.
  • Server.java - Establishes a server socket, which is composed of 2 sockets (1 to accept files, 1 to accept text). Continually creates new server sockets (threads/handelers) to accept more and more new clients.

💻 Instructions

  1. Pick a device to use as a server (e.g. your laptop). Download the 4 files above on that device.
  2. Edit the Server file to include the Internet address and port appropriate for your device. Edit lines 11-12:
String host = "192.168.1.130"; // This should be your private IP address
int port = 1111; // Pick any port on your device
InetAddress inetAddress = InetAddress.getByName(host); 
ServerSocket serverSocket = new ServerSocket(port, 5, inetAddress); 
  1. Start the server by running the Server file. You should then see a printed confirmation that the Server is running.
$ javac Server.java
$ java Server
Server created. Waiting for at least 1 client to connect...
  1. Next, each device using the group chat should download Client.java.
  2. Mimic step #2 on Client.java to make sure the host and port on the client (lines 32-33) match the server file (lines 11-12).
  3. Compile and run Client.java. Each user should answer the 2 questions in the terminal. Then, the program will initialilze the chat GUI:

3) all

3) all

4) bye

About

A private chatroom that 2+ devices can share over WiFi.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages