![]() |
Banking_System_Client
1.0.0
Qt-based banking app for user/admin account management, transactions, secure server communication via PostgreSQL/Supabase.
|
A class for managing TCP client connections. More...
#include <tcpclient.h>
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... | |
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.
|
explicit |
TcpClient::~TcpClient | ( | ) |
void TcpClient::closeConnection | ( | ) |
Close the TCP connection.
Closes the connection to the server if it is open.
Referenced by ClientHandler::requestClientDisconnection().
void TcpClient::connectToServer | ( | const QString & | host, |
quint16 | port | ||
) |
Connect to a TCP server.
host | The host address of the server. |
port | The port number to connect to. |
Initiates a connection to the specified server.
Referenced by ClientHandler::requestClientConnection().
|
signal |
Signal emitted when a response is ready.
response | The response data received from the server. |
Referenced by ClientHandler::run().
void TcpClient::sendTcpRequest | ( | const QByteArray & | request | ) |
Send a TCP request.
request | The request data to be sent. |
Sends the specified request to the connected server.
Referenced by ClientHandler::sendRequest().