A Java console application that connects to the EventBoard TCP Server and allows users to manage events interactively.
Includes a fully implemented import-from-URL feature for bulk event loading with detailed validation.
-
TCP client for the EventBoard Server (port 5550 by default).
-
Clean console interface with a simple command menu.
-
Supports the full text-based event protocol:
add; date; time; descriptionremove; date; time; descriptionlist; date; -; -STOP
-
Extra feature: HTTP import from a remote
.txtfile using:import; https://example.com/events.txt -
Performs validation on each line before sending to the server:
- Wrong number of fields.
- Empty fields (
date,time,description). - Time not matching the expected format (
6 pmor7.30 pm). - Description containing a semicolon.
- Lines ending with a trailing
;.
-
Prints per-line reasons for skipped events.
-
Ensures only valid, sanitised events are sent to the server.
| Area | Technology |
|---|---|
| Language | Java 17+ |
| Networking | TCP client using Socket |
| I/O | BufferedReader, PrintWriter |
| HTTP | URL, URLConnection |
| Validation | Custom time checks and field validation |
eventboard-client/
└─ EventClientMain.java # Console UI, TCP logic and URL import
Compile (from the folder that contains the eventboard package):
javac eventboard/*.java
Run the client:
java eventboard.EventClientMain
Make sure the EventBoard Server is already running on localhost:5550.
When the client starts, it displays a small help menu:
add; date; time; descriptionremove; date; time; descriptionlist; date; -; -import; http://.../events.txtSTOP
Examples:
add; 12 December 2025; 6 pm; Winter Choir Event
remove; 5 January 2026; 1.30 pm; Paper Lantern Colouring
list; 3 March 2026; -; -
import; https://example.com/events.txt
STOP
Every command is sent over TCP to the server, and the client prints the server’s reply.
The most interesting feature of this client is the import command:
import; https://example.com/events.txt
Internally, the client:
- Extracts the URL from the command.
- Opens an HTTP connection using
URL+URLConnection. - Reads the file line by line via a
BufferedReader. - For each non-empty line:
- Splits by
;and expects exactly 3 fields:datetimedescription
- Trims all fields.
- Rejects lines where any field is empty.
- Rejects lines where the description contains a semicolon.
- Rejects lines where the original line ends with
;. - Uses
looksLikeTime(time)to validate format (6 pm,7.30 pm, etc.).
- Splits by
- If a line passes all checks:
-
Builds a valid server command:
add; date; time; description -
Sends it to the server over TCP.
-
Prints the server response.
-
Increments the
importedcounter.
-
- If a line is invalid:
-
Prints a message like:
Skipped line 112: wrong number of fields Skipped line 114: invalid time format -
Increments the
skippedcounter.
-
At the end, the client prints a summary such as:
Imported: 100; Skipped: 12
The helper method looksLikeTime(String time) checks:
- The time string is composed of two parts separated by whitespace:
numberPart(e.g.6,7.30)ampm(amorpm)
ampmmust be exactlyamorpm.numberPartmay contain a dot:- If it does, it is split into
hourandminuteparts.
- If it does, it is split into
- Both
hourandminutemust be valid integers. - Hours and minutes must be within valid ranges.
This ensures the client does not send obviously invalid times to the server.
- Building a TCP client that communicates using a custom protocol.
- Implementing a console-based UI with clear commands.
- Reading from remote HTTP resources in Java.
- Performing robust input validation before pushing data to the backend.
- Handling error scenarios gracefully and reporting skipped lines.
- Interoperating cleanly with a multi-threaded Java TCP server.
- Allow server host/port to be set via command-line arguments.
- Add support for local file import (e.g.
import-file; events.txt). - Improve console UX:
- Command history.
- Coloring for errors vs success.
- Add basic unit tests for
looksLikeTimeand the import logic. - Wrap the client in a simple shell script or batch file for easier launching.
Leandro Crisol — Student No. 23156503
BSc (Honours) in Computing — National College of Ireland