Skip to content

About

A lightweight weather forecasting application utilizing the OpenWeatherMap REST API to visualize real-time and historical global weather data.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-Client TCP Server

A Java TCP client/server pair in which the server accepts multiple clients at once, handling each connection on its own thread, and echoes every message back in upper case.

What it does

  • TCP_Server listens on port 56783 and loops on accept(); each new connection is given an incrementing client number and logged (Server is now connected to the N Client).
  • Each connection is handed to a separate thread (subclass of java.lang.Thread), so several clients can be served concurrently.
  • The handler thread reads one line at a time, converts it to upper case, prints it on the server console and sends it back to the client.
  • TCP_Client connects to localhost:56783, reads lines from the keyboard, sends them to the server and prints the reply (FROM SERVER: ...).
  • Typing Close Socket (case-insensitive) ends the session: the client closes its socket and exits, and the server's handler thread for that client stops while the server keeps accepting new clients.

Tech stack

  • Java (standard library only: java.net.ServerSocket, java.net.Socket, java.lang.Thread, java.io streams)
  • Eclipse project files

Repository contents

src/
  TCP_Server.java   Server: accepts connections and starts a handler thread per client
  thread.java       Per-client handler thread (read line -> upper-case -> reply)
  TCP_Client.java   Console client
.classpath, .project, .settings/   Eclipse project files

How to run

From the repository root:

javac -d bin src/*.java

# Terminal 1 – start the server first
java -cp bin TCP_Server

# Terminals 2, 3, ... – start one or more clients
java -cp bin TCP_Client

Type a message in a client terminal to get it back in upper case; type Close Socket to disconnect that client.

The classes can also be run from Eclipse (run TCP_Server, then TCP_Client one or more times).


Developed by Khaled Walid

About

A lightweight weather forecasting application utilizing the OpenWeatherMap REST API to visualize real-time and historical global weather data.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages