The VSFlix project's goal is to be able to make one or multiple clients communicate with a single one server in order to retrieve files shared by the clients.
There are two ways to run the project:
- Run the server and client JARs: The first and fastest way is to simply download the server and client JARs from the releases section and run them with the commands
java -jar server.jar
andjava -jar client.jar
. - Run the project with your editor:
-
Download the project files to your computer and open the project in your favorite IDE (Eclipse, IntelliJ IDEA, etc.).
-
Download the project dependencies with Maven. (This step is often proposed or performed automatically by the IDE)
-
Run the server. The starting class for the server is
ch.dc.Main
in the server folder.N. B. : The server listens any incoming connection on ip address
0.0.0.0
and uses by default port50000
. If this port is already used by another process, you can change it directly in the starting class or by passing the port number as an argument when running the program. -
Run one (or more) client(s). The starting class for the client application is
ch.dc.Main
in the client folder.
-
Once you successfully ran the server and the client, you will be able to use the VSFlix client to stream (bidirectionnal stream) files from / to the other connected clients !
In IntelliJ, you create JARs by creating what they call artifacts:
- Open
Project Structure
and go toArtifacts
. - Click on the
+
sign, thenJAR
>From modules with dependencies
, then fill in the fields:- Select the module you want to create the JAR for and its main class
- For
JAR files from libraries
, selectextract to the target JAR
. - For
Directory for META-INF/MANIFEST.MF
, the client and server JARs have differents paths:- For the client JAR, the path will automatically point to the resources folder (
[...]\src\main\resources
). If it is not, you can set it to point to the resources folder. - For the server JAR, the path will automatically point to the java source folder (
[...]\src\main\java
). Change it to point to the src folder ([...]\src
).
- For the client JAR, the path will automatically point to the resources folder (
- Click "OK" to finish the artifact configuration.
- In the menu bar, click
Build
>Build artifacts...
>All Artifacts
>Build
.
Once you have done these steps, both the server and client JARs will have been created in the out\artifacts
folder at root of the project !
Before creating the JARs, make sure the build path of each module is correctly set up. See these build path examples screenshots to see how the build paths should be configured. To configure the build path, right click on the module you want to configure the build path for and select Build Path
> Configure Build Path...
, then see the "source" tab.
Then, create the JAR with the following steps:
- In the Project Exporer, right click on the module you want to export, then select
Export
. - In the export window, select
Java
>Runnable JAR file
, then click "Next". - In the Runnable JAR file Specification window, fill in the fields:
- For
Launch configuration
, select the correct configuration (the dropdown list will be empty if you have never run the client module via the editor yet). - For
Export destination
, fill in the path of the to-be-created JAR (e.g.[...]\Desktop\client.jar
). The path must end with a filename ! - For
Library handling
, selectExtract required libraries into generated JAR
.
- For
- Click "Finish".
Once you have done these steps, the JAR will have been created in the selected location !
This project relies entirely on Java :
- The client application has been made with JavaFX
- The server and its internal HTTP server have been developed in pure Java
The VSFlix client and server have there own way of communicating. The communication is based on simple text commands that the client sends every time it needs to retrieve a particular information.
Possible commands :
Command | Action |
---|---|
HTTPPORT <http_port> | Send the client HTTP Server port to the server when the client connects. |
GETALLFILES | Request all shared files from the server. |
ADDFILE | Send a FileEntry object for the server to add it to its shared files. |
UNSHAREFILE | Send a FileEntry object for the server to remove it from its shared files. |
GETNBCONNECTEDCLIENTS | Request the number of connected clients. |
DISCONNECT | Send a request to end the connection. It must be noted that the client does not wait on the server to close its own connection. |
- JavaFX - Open source client application platform for desktop, mobile and embedded systems built on Java
- FontAwesome - Icons library and toolkit
- Maven - Software project management and comprehension tool
Daniel Roduit |
Cathy Gay |
This project is licensed under the MIT License