A UDP server that receives datagrams and queues outgoing datagrams.
More...
#include <udpserver.h>
|
| void | datagramReceived (const QNetworkDatagram &datagram) |
| | Emitted when a datagram is received.
|
| |
|
void | started () |
| | Emitted when the worker thread has started.
|
| |
|
void | finished () |
| | Emitted when the worker thread has finished.
|
| |
|
| | UdpServer (const QHostAddress &serverAddress, int serverPort) |
| | Construct a UdpServer bound to the given address and port.
|
| |
| void | writeDatagram (const QByteArray &datagram, const QHostAddress &address, int port) |
| | Queue a datagram for transmission to the specified address and port.
|
| |
| void | writeDatagram (const QNetworkDatagram &datagram) |
| | Queue a fully-specified datagram for transmission.
|
| |
| | AbstractThreadClass (const Log::LogCategory &category=Log::LogCategory(), QObject *parent=nullptr) |
| | Construct with an optional log category and parent.
|
| |
| | AbstractThreadClass (const QString &category, QObject *parent=nullptr) |
| | Construct with a category name string and optional parent.
|
| |
|
virtual | ~AbstractThreadClass () |
| | Destructor — stops the thread if still running.
|
| |
| virtual bool | start (const TimeSpan &timeout=TimeSpan::zero()) |
| | Start the worker thread and optionally wait for it to signal readiness.
|
| |
| virtual bool | stop (const TimeSpan &timeout=TimeSpan::zero()) |
| | Request the worker thread to stop and optionally wait for it to finish.
|
| |
|
virtual void | abort () |
| | Immediately interrupt the worker thread (sets the stopping flag).
|
| |
| bool | waitForCompletion (const TimeSpan &timeout=TimeSpan::zero()) |
| | Block until the worker thread finishes or the timeout elapses.
|
| |
| bool | isRunning () const |
| | Test whether the worker thread is currently running.
|
| |
| bool | isStopping () const |
| | Test whether stop() has been called and the thread is winding down.
|
| |
| bool | success () const |
| | Return whether the last run completed successfully.
|
| |
| QString | completionMessage () const |
| | Return the completion message set by finishAndStop().
|
| |
| void | setBlockingStart (bool value) |
| | Control whether start() blocks until the thread signals readiness.
|
| |
| | LoggingBaseClass (const Log::LogCategory &category=Log::LogCategory()) |
| | Construct with an optional log category.
|
| |
| | LoggingBaseClass (const QString &category) |
| | Construct with a category name string.
|
| |
| Log::LogCategory | logCategory () const |
| | Return the base log category.
|
| |
|
| virtual void | threadFinished () |
| | Called on the worker thread just before it exits.
|
| |
| bool | waitForStart (const TimeSpan &timeout) |
| | Block until the thread has entered threadStarted() or the timeout elapses.
|
| |
| void | finishAndStop (bool success, const QString &message=QString()) |
| | Signal that the worker has finished, recording success and a message.
|
| |
| void | writeLine (const QString &line) |
| | Write a line to the standard output stream.
|
| |
| void | writeErrorLine (const QString &line) |
| | Write a line to the standard error stream.
|
| |
| Log::LogCategory | LVL0 () const |
| | Return the base (level 0) log category.
|
| |
| Log::LogCategory | LVL1 () const |
| | Return the level-1 sub-category.
|
| |
| Log::LogCategory | LVL2 () const |
| | Return the level-2 sub-category.
|
| |
| Log::LogCategory | LVL3 () const |
| | Return the level-3 sub-category.
|
| |
| void | logText (const char *file, int lineNumber, Log::LogLevel level, const QString &text) const |
| | Write a text message to the system logger using the base category.
|
| |
| void | logText (const char *file, int lineNumber, Log::LogLevel level, const Log::LogCategory &category, const QString &text) const |
| | Write a text message to the system logger using an explicit category.
|
| |
| void | logHex (const char *file, int lineNumber, Log::LogLevel level, const QByteArray &data, const QString &tag=QString()) const |
| | Write a hex dump to the system logger.
|
| |
| void | logHex (const char *file, int lineNumber, Log::LogLevel level, const Log::LogCategory &category, const QByteArray &data, const QString &tag=QString()) const |
| | Write a hex dump to the system logger using an explicit category.
|
| |
| void | addLogConsumer (LogConsumer *consumer) |
| | Register an external log consumer to receive entries from this class.
|
| |
| void | removeLogConsumer (LogConsumer *consumer) |
| | Remove a previously added log consumer.
|
| |
A UDP server that receives datagrams and queues outgoing datagrams.
Receives and transmits UDP datagrams in a dedicated thread.
UdpServer binds to the configured address and port on start(). Incoming datagrams are delivered via the datagramReceived() signal. Outgoing datagrams are queued and sent asynchronously via writeDatagram().
Definition at line 20 of file udpserver.h.
◆ UdpServer()
| UdpServer::UdpServer |
( |
const QHostAddress & |
serverAddress, |
|
|
int |
serverPort |
|
) |
| |
Construct a UdpServer bound to the given address and port.
- Parameters
-
| serverAddress | Address to bind to |
| serverPort | Port to bind to |
◆ datagramReceived
| void UdpServer::datagramReceived |
( |
const QNetworkDatagram & |
datagram | ) |
|
|
signal |
Emitted when a datagram is received.
- Parameters
-
| datagram | The received datagram including sender address and port |
◆ writeDatagram() [1/2]
| void UdpServer::writeDatagram |
( |
const QByteArray & |
datagram, |
|
|
const QHostAddress & |
address, |
|
|
int |
port |
|
) |
| |
Queue a datagram for transmission to the specified address and port.
- Parameters
-
| datagram | Payload bytes to send |
| address | Destination address |
| port | Destination port |
◆ writeDatagram() [2/2]
| void UdpServer::writeDatagram |
( |
const QNetworkDatagram & |
datagram | ) |
|
Queue a fully-specified datagram for transmission.
- Parameters
-
| datagram | QNetworkDatagram including destination address and port |
The documentation for this class was generated from the following file: