Coder Social home page Coder Social logo

java-chat's Introduction

Java Chat Server and Client

This project is a simple implementation of a chat server and client in Java using the UDP protocol. It was developed by Arthur Rigonnet and Ponton Mathieu as part of the Networks course in the 3rd year of FISA at Polytech Lyon, under the supervision of Mr. Lucas De Meyer.

Project Structure

The project is divided into two main parts: the server and the client, both implemented in Java.

Server

The server, implemented in serveurUDP.java, is a class that implements Runnable. It uses a DatagramSocket to listen for incoming messages from clients. The server maintains a Map where the key is the chat room number and the value is a list of client information in that room. The server also has a method sendMessagesToClient which sends messages to a specific client.

Client

The client, implemented in clientUDP.java, is a class that initializes a DatagramSocket to communicate with the server. The user is prompted to enter the chat room number and the client sends a message to the server to join that room. Once in the chat room, the user can send messages which will be received by all other users in the same room.

Usage

To use this project, you need to first start the server by running the serveurUDP.java file. Then, you can start as many clients as you want by running the clientUDP.java file. When prompted, enter the chat room number to join a chat room.

Conclusion

This project is a simple demonstration of how to use UDP sockets for client-server communication in Java. We have reworked the code, especially to ensure that clients do not need to fetch messages from the server, but the server sends them messages directly. We have also added features such as the ability to choose your nickname and timeouts, which close the sockets after a certain period of client inactivity.

java-chat's People

Contributors

tatu03tv avatar claquettes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.