Skip to content

A simple chat room using java socket with the client-server paradigm

License

Notifications You must be signed in to change notification settings

sontx/chat-socket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gitter chat

chat-socket is a simple chat application includes chat client and chat server. Support multiple users, private chat, and personal status. This project is based on TCP socket, multi-threading, JavaFx, Java Swing, Java serialization, and JSON.

Prerequisites

To compile this project, you need to install these things:

Installing

Build (binary file will be placed in target directory):

mvn clean compile assembly:single

Run (will ask you for working mode):

mvn exec:java

Usage

Both server and client are in chatsocket-x.y-SNAPSHOT-jar-with-dependencies.jar (to get this jar file you need to build this project).

  1. Server app: java -jar chatsocket.jar --mode=server
  2. Client app: java -jar chatsocket.jar --mode=client

App settings will be saved in app.json file

{
  "modified" : 1580791811962,
  "settings" : [ {
    "key" : "client",
    "data" : {
      "serverIp" : "127.0.0.1",
      "serverPort" : 3393,
      "loggedUserName" : "sontx"
    }
  }, {
    "key" : "server",
    "data" : {
      "ip" : "127.0.0.1",
      "port" : 3393
    }
  } ]
}

Server

The server needs to listen to an IP and a port number, other clients will connect to this address. Fill up these boxes and click on Start button to start the server.

All users data will be saved in user.json file.

[ {
  "id" : "7453f7f5105547179f0845cd03fe4eda",
  "username" : "sontx",
  "passwordHash" : "7c4a8d09ca3762af61e59520943dc26494f8941b",
  "profile" : {
    "displayName" : "Tran Xuan Son",
    "status" : "I'm just a beginner"
  }
} ]

Client

  1. Connect to the server.

  1. Then login with your account

  1. Or register a new one.

  1. Other users will be shown in your friend list.

  1. To update your userProfile, double-click to the avatar.

  1. Double-click to any online friend to chat

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Dependencies

Author

Developed by sontx:

License

MIT