TCP client that implements the NDEVR communication protocol over a QTcpSocket.
More...
|
| | AdaptiveTCPClient (QObject *parent=nullptr) |
| | Constructs the TCP client.
|
| void * | connectTo (const NDEVRServerInfo &server) override |
| | Establishes a connection to the specified server.
|
| void | connectToServer (const StringView &host, uint04 port) |
| | Initiates a TCP connection to the specified host and port.
|
| virtual void | disconnectFrom (void *socket) override |
| | Disconnects from the specified socket.
|
| virtual bool | isOpen (void *socket=nullptr) const override |
| | Checks whether the socket is currently connected.
|
| virtual uint08 | rx (void *socket, NDEVRDataPacket &packet) override |
| | Receives data from the socket into a packet.
|
| virtual uint08 | tx (void *socket, NDEVRDataPacket &packet, uint08 size) override |
| | Transmits packet data through the socket.
|
| virtual void | wait (const TimeSpan &span, LogPtr log=nullptr) override |
| | Waits for the specified time span, processing events.
|
|
|
QTimer | m_send_timer |
| | Timer for periodic send buffer flushing.
|
|
QTcpSocket * | m_server_socket |
| | The underlying TCP socket.
|
|
QTimer | reconnectTimer |
| | Timer for automatic reconnection attempts.
|
TCP client that implements the NDEVR communication protocol over a QTcpSocket.
Provides automatic reconnection, buffered sending, and integrates with the NDEVRCommunicationLogic framework for packet-based data transfer.
Definition at line 15 of file AdaptiveTCPClient.h.
◆ AdaptiveTCPClient()
| AdaptiveTCPClient::AdaptiveTCPClient |
( |
QObject * | parent = nullptr | ) |
|
|
explicit |
Constructs the TCP client.
- Parameters
-
| [in] | parent | Optional parent QObject. |
◆ connectTo()
Establishes a connection to the specified server.
- Parameters
-
| [in] | server | The server information to connect to. |
- Returns
- An opaque pointer to the connection socket.
◆ connectToServer()
| void AdaptiveTCPClient::connectToServer |
( |
const StringView & | host, |
|
|
uint04 | port ) |
Initiates a TCP connection to the specified host and port.
- Parameters
-
| [in] | host | The hostname or IP address to connect to. |
| [in] | port | The TCP port number. |
◆ disconnectFrom()
| virtual void AdaptiveTCPClient::disconnectFrom |
( |
void * | socket | ) |
|
|
overridevirtual |
Disconnects from the specified socket.
- Parameters
-
| [in] | socket | The socket to disconnect. |
◆ isOpen()
| virtual bool AdaptiveTCPClient::isOpen |
( |
void * | socket = nullptr | ) |
const |
|
overridevirtual |
Checks whether the socket is currently connected.
- Parameters
-
| [in] | socket | The socket to check, or nullptr for the default. |
- Returns
- True if the connection is open.
◆ rx()
| virtual uint08 AdaptiveTCPClient::rx |
( |
void * | socket, |
|
|
NDEVRDataPacket & | packet ) |
|
overridevirtual |
Receives data from the socket into a packet.
- Parameters
-
| [in] | socket | The socket to receive from. |
| [in] | packet | The packet buffer to fill. |
- Returns
- The number of bytes received.
◆ tx()
| virtual uint08 AdaptiveTCPClient::tx |
( |
void * | socket, |
|
|
NDEVRDataPacket & | packet, |
|
|
uint08 | size ) |
|
overridevirtual |
Transmits packet data through the socket.
- Parameters
-
| [in] | socket | The socket to send through. |
| [in] | packet | The packet data to send. |
| [in] | size | The number of bytes to send. |
- Returns
- The number of bytes sent.
◆ wait()
| virtual void AdaptiveTCPClient::wait |
( |
const TimeSpan & | span, |
|
|
LogPtr | log = nullptr ) |
|
overridevirtual |
Waits for the specified time span, processing events.
- Parameters
-
| [in] | span | The duration to wait. |
| [in] | log | Optional log for progress reporting. |
The documentation for this class was generated from the following file: