| <large>libXpertMassCore and libXpertMassGui Developer Documentation</large>

- libXpertMassCore
- MassDataClient

# MsXpS::libXpertMassCore::MassDataClient Class

class MsXpS::libXpertMassCore::MassDataClient

The MassDataClient class provides a network client. More...

Header: | `#include <MassDataClient.hpp>`
Inherits: | QObject

- List of all members, including inherited members
- MassDataClient is part of libXpertMassCore Utilities.

## Public Functions

| MassDataClient(const QString &ip_address, int port_number, QObject *parent = nullptr)
virtual | ~MassDataClient()
QString | getStatus()

## Protected Slots

virtual void | readData()
void | reportError(QAbstractSocket::SocketError socket_error)

## Protected Variables

QByteArray | m_data
bool | m_forcefulDisconnection
QDataStream | m_inStream
QString | m_ipAddress
int | m_portNumber
QTcpSocket * | mp_tcpSocket

## Detailed Description

## Member Function Documentation

### `[explicit]` MassDataClient::MassDataClient(const QString &ip_address, int port_number, QObject *parent = nullptr)

Constructs a MassDataClient instance.

- ip_address: the server (MassDataServer) IP address at which the client needs to try a connection.
- port_number: the port number for the connection.
- parent: the parent QObject.

### `[virtual noexcept]` MassDataClient::~MassDataClient()

Destructs this MassDataClient instance.

### QString MassDataClient::getStatus()

Returns a string display the connection details.

### `[virtual protected slot]` void MassDataClient::readData()

Reads the data into the QByteArray m_data member using the QDataStream m_inStream member.

Emits the newDataSignal() signal with m_data;.

### `[protected slot]` void MassDataClient::reportError(QAbstractSocket::SocketError socket_error)

Reports the error socket_error.

## Member Variable Documentation

### QByteArray MassDataClient::m_data

This variable holds the data being transported.

### bool MassDataClient::m_forcefulDisconnection

Tells if the disconnection was forceful.

### QDataStream MassDataClient::m_inStream

This variable holds the data stream in input into this MassDataClient instance.

### QString MassDataClient::m_ipAddress

This variable holds the server IP address to which the connection must be made.

### int MassDataClient::m_portNumber

This variable holds the port number to which to attach during the connection.

### QTcpSocket *MassDataClient::mp_tcpSocket

This variable holds the socket that is used for the connection to the server.