A neat little project I made where you can host a server which holds a database, then a client can connect and retrieve data from that database. THIS ONLY WORKS WITH WINDOWS!!!
It uses the Winsock API to setup a TCP server on a specified IP and port, then that server holds a custom database class for users and accounts. Then, there is a client which connects to that IP and port through the Winsock API and that client can send requests and recieve a response. I tried my best to make this very easy to use and understand, all you need is some intermediate C++ knowledge and you'll be good to go!
First, make sure you are on windows AND have G++ installed before setting up or using this.
-
Download the source code:
git clone https://github.com/Plinkon/LocalServerSideAuth.git
-
Open the Client.cpp and Server.cpp files in the following directories:
Client.cpp:cd src/client/Server.cpp:cd src/server/ -
Open the 2 files with any editor and configure the definitions at the top of each file:
#define USE_PORT_FROM_FILE false // if true, make sure to put a port in the ../port/port.txt file #define PORT 5816 // set this to the port you want to use IF you're not using the port from a file #define HOST_IP_ADDRESS "127.0.0.1" // set this to the IP address you want to use
-
Navigate to the
scripts/compile/folder (you can also use the command from one of the source file folders):cd ../../scripts/compile/ -
Now run the
compile.batscript.
Now the project should be compiled!
- Go to the path (from the compile folder):
cd ../../output/
And now you are all set to get up and running!
- Run the
server.exefile - Initialize the server by typing
1or0 - Then, run the
client.exefile
And that's it! If working correctly, the client should be connected to the server. Now take some time to explore the features of the CLI in the server.