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

A class for managing TCP client connections. More...

#include <tcpclient.h>

Inheritance diagram for TcpClient:
Inheritance graph
Collaboration diagram for TcpClient:
Collaboration graph

Signals

void ResponseReadySignal (QByteArray response)
 Signal emitted when a response is ready. More...
 
void ConnectedSignal ()
 Signal emitted when connected to the server.
 
void DisconnectedSignal ()
 Signal emitted when disconnected from the server.
 

Public Member Functions

 TcpClient (QObject *parent=nullptr)
 Constructor for TcpClient. More...
 
 ~TcpClient ()
 Destructor for TcpClient. More...
 
void connectToServer (const QString &host, quint16 port)
 Connect to a TCP server. More...
 
void sendTcpRequest (const QByteArray &request)
 Send a TCP request. More...
 
void closeConnection ()
 Close the TCP connection. More...
 

Detailed Description

A class for managing TCP client connections.

The TcpClient class is responsible for establishing a connection to a TCP server, sending requests, receiving responses, and handling various socket states and errors. It provides signals for connection status and incoming responses.

Constructor & Destructor Documentation

◆ TcpClient()

TcpClient::TcpClient ( QObject *  parent = nullptr)
explicit

Constructor for TcpClient.

Parameters
parentThe parent object.

Initializes the TcpClient object and connects the necessary signals and slots.

◆ ~TcpClient()

TcpClient::~TcpClient ( )

Destructor for TcpClient.

Cleans up the TcpClient object, ensuring the socket is properly deleted.

Member Function Documentation

◆ closeConnection()

void TcpClient::closeConnection ( )

Close the TCP connection.

Closes the connection to the server if it is open.

Referenced by ClientHandler::requestClientDisconnection().

Here is the caller graph for this function:

◆ connectToServer()

void TcpClient::connectToServer ( const QString &  host,
quint16  port 
)

Connect to a TCP server.

Parameters
hostThe host address of the server.
portThe port number to connect to.

Initiates a connection to the specified server.

Referenced by ClientHandler::requestClientConnection().

Here is the caller graph for this function:

◆ ResponseReadySignal

void TcpClient::ResponseReadySignal ( QByteArray  response)
signal

Signal emitted when a response is ready.

Parameters
responseThe response data received from the server.

Referenced by ClientHandler::run().

Here is the caller graph for this function:

◆ sendTcpRequest()

void TcpClient::sendTcpRequest ( const QByteArray &  request)

Send a TCP request.

Parameters
requestThe request data to be sent.

Sends the specified request to the connected server.

Referenced by ClientHandler::sendRequest().

Here is the caller graph for this function:

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