Banking_System_Server  1.0.0
Qt-based banking app for user/admin account management, transactions, secure server communication via PostgreSQL/Supabase.
ServerHandler Class Reference

The ServerHandler class handles incoming client connections in a separate thread. More...

#include <serverhandler.h>

Inheritance diagram for ServerHandler:
Inheritance graph
Collaboration diagram for ServerHandler:
Collaboration graph

Public Member Functions

 ServerHandler (QMutex *m, qintptr handle=0, QObject *parent=nullptr)
 Constructs a ServerHandler object with the specified parameters. More...
 
 ~ServerHandler ()
 Destructor for the ServerHandler class. More...
 
void readyRead ()
 Slot to handle readyRead signal from QTcpSocket. More...
 
void run ()
 Implements QRunnable's run method to handle the client connection. More...
 

Detailed Description

The ServerHandler class handles incoming client connections in a separate thread.

This class is responsible for managing communication with a client, verifying data integrity using cryptographic hashes, and processing requests through the RequestManager. It operates in a separate thread to ensure that the server remains responsive.

Constructor & Destructor Documentation

◆ ServerHandler()

ServerHandler::ServerHandler ( QMutex *  m,
qintptr  handle = 0,
QObject *  parent = nullptr 
)
explicit

Constructs a ServerHandler object with the specified parameters.

Initializes the ServerHandler with a mutex, socket handle, and optional parent QObject.

Parameters
mPointer to a QMutex used for synchronization.
handleThe socket descriptor for the incoming connection.
parentThe parent QObject.

◆ ~ServerHandler()

ServerHandler::~ServerHandler ( )

Destructor for the ServerHandler class.

Cleans up resources by deleting the client socket and RequestManager.

Member Function Documentation

◆ readyRead()

void ServerHandler::readyRead ( )

Slot to handle readyRead signal from QTcpSocket.

Reads data from the client socket, verifies its integrity using a cryptographic hash, and processes the request using RequestManager. Sends the response back to the client.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

void ServerHandler::run ( )

Implements QRunnable's run method to handle the client connection.

Sets up the client socket, connects signals for reading data and disconnection, and starts the event loop to process client requests.

Here is the call graph for this function:

The documentation for this class was generated from the following files: