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

- libXpertMassCore
- MassDataServer

# MsXpS::libXpertMassCore::MassDataServer Class

class MsXpS::libXpertMassCore::MassDataServer

The MassDataServer class provides a network server. More...

Header: | `#include <MsXpS/libXpertMassCore/MassDataServer.hpp>`
Inherits: | QTcpServer

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

## Public Functions

| MassDataServer(QObject *parent = nullptr)
virtual | ~MassDataServer()
bool | hasReadyClient() const
void | serveData(const QByteArray &byte_array_to_serve)

## Protected Functions

void | error(QAbstractSocket::SocketError socket_error)

## Reimplemented Protected Functions

virtual void | incomingConnection(qintptr socket_descriptor) override

## Protected Variables

QList<QTcpSocket *> | m_clients
QString | m_ipAddress
int | m_portNumber
QSet<QTcpSocket *> | m_readyClients

## Detailed Description

## Member Function Documentation

### MassDataServer::MassDataServer(QObject *parent = nullptr)

Constructs a MassDataServer instance.

- parent: QObject parent.

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

Destructs this MassDataServer instance.

### `[protected]` void MassDataServer::error(QAbstractSocket::SocketError socket_error)

Reports the socket_error to the console using qDebug().

### bool MassDataServer::hasReadyClient() const

Returns true if this server has clients (MassDataClient) that are ready to receive data.

### `[override virtual protected]` void MassDataServer::incomingConnection(qintptr socket_descriptor)

Reimplements: QTcpServer::incomingConnection(qintptr socketDescriptor).

Handles an incoming connection with socket descriptor socket_descriptor.

If the connection is effective, that is, if a QTcpSocket client could be allocated and configured with socket_descriptor, that client is appended to the m_clients list of clients.

### void MassDataServer::serveData(const QByteArray &byte_array_to_serve)

Sets to this MassDataServer instance the data to be served in byte_array_to_serve.

## Member Variable Documentation

### QList<QTcpSocket *> MassDataServer::m_clients

This variable holds the list of QTcpSocket instances representing the clients connected to this server.

### QString MassDataServer::m_ipAddress

This variable holds the IP address at which this server serves data.

### int MassDataServer::m_portNumber

This variable holds the port number at which this server serves data.

### QSet<QTcpSocket *> MassDataServer::m_readyClients

This variable holds the list of QTcpSocket instances representing the clients connected to this server and effectively expecting data from this server.