Project specifications (ita):
http://vecchio.iet.unipi.it/se/files/2019/05/Progetto-2018_2019-Sistemi-di-Elaborazione.pdf
Client/server application for hotel bookings.
Client and server communicate via TCP sockets. The server is concurrent and the concurrency is implemented with POSIX threads.
The server indefinitely waits for new incoming connections and every accepted connection is dispatched to a thread – in a pre-allocated pool of threads – in charge of
managing the requests of the client.
The reservations are constrained to the year 2020.
Linux:
sudo apt-get install sqlite3
sudo apt-get install libsqlite3-dev
sudo apt-get install sqlitebrowser # optional
macOS:
brew install sqlite3 # optional
brew cask install db-browser-for-sqlite # optional
git clone https://github.com/urbanij/hotel-booking.git
cd hotel-booking/
mkdir build && cd build
cmake ..
make
scons -Y ..
- open a terminal session and run the server:
./bin/server 127.0.0.1 8888 5
- open one or more terminal sessions and run the client(s)
./bin/client 127.0.0.1 8888
where:
127.0.0.1
is the IP address (in this case localhost),
8888
is the port number and
5
the initial total number of available room in the hotel.
(may require root privileges on macOS)
make sure to compile with -DGDB_MODE
, then run gdb ./server
.
Inside gdb type r
to run and you're good to go.
For an easier debugging experience this is recommended.
1: tested on Linux Ubuntu 18, Raspbian and macOS.