/client-server

Primary LanguageJavaMIT LicenseMIT

Client-Server-Project

( This project is implemented using JDK 19 )

General Info

With this project you can interact with a local server on your PC that receives a command from the client and gives back some informations or results.

You can run the code using an IDE (for example: IntelliJ IDEA from JetBrains ). If you want to use the terminal ( for GNU/Linux or MacOS ) or the command prompt ( for Windows ), you have to install the JRE 19 on your machine.

Java version

To check the java version using the terminal :

$ java -version

You should get something similar to this :

JRE installation

To install JRE 19 using the terminal, use the following command :

Debian/Ubuntu

$ sudo apt install openjdk-19-jre 

Arch Linux

$ sudo pacman -S jre-openjdk

Fedora

$ sudo dnf install -y java-19-openjdk

OpenSuse

$ sudo zypper --non-interactive install java-19-openjdk

Usage

In order to use this project the right way and see how it functions, you need to follow the following steps :

  1. Connect to the local server using port-number 2022 ( other port-numbers won´t be accepted )

  1. Connect the client with the server :

    • Ip-Address : localhost or 127.0.0.1
    • Port : 2022

  1. As a client give one of the following commands and you will get some information from the server depending on which command is passed on :
Command Output Command Output
ECHO message message HISTORY all given commands
CURRENT TIME the current time ( format : HH:mm:ss ) HISTORY k the last k given commands. If k > the number of all given commands, you will get all guven commands.
CURRENT DATE the current date ( format : dd.MM.yyyy) LIST country a list of all universities in the given country
ADD num1 num2 num1 + num2 LATEST NEWS the latest news using an API GET request from tagesschau
SUB num1 num2 num1 - num2 HOLIDAYS x all the holidays in Germany in year x
MUL num1 num2 num1 * num2 PING PONG
DIV num1 num2 num1 / num2 others ERROR
  • Some examples : example 1

  • List all universities in Germany : example 2