|
|
using | port_type = quint16 |
|
| Q_SLOT bool | ensureConnected (QString host, port_type port, int msecs=5000) |
| | Ensures that the TCP client is connected to the specified host and port.
|
| Q_SLOT bool | sendNetworkMessage (QString host, port_type port, QByteArray const &message, bool crlf=true, int msecs=5000) |
| | Sends a network message to the specified host and port.
|
◆ TCPClient()
| TCPClient::TCPClient |
( |
QObject * | parent = nullptr | ) |
|
|
explicit |
◆ ensureConnected
| bool TCPClient::ensureConnected |
( |
QString | host, |
|
|
port_type | port, |
|
|
int | msecs = 5000 ) |
|
slot |
Ensures that the TCP client is connected to the specified host and port.
- Parameters
-
| host | The hostname or IP address to connect to. |
| port | The port number to connect to. |
| msecs | The timeout in milliseconds to wait for the connection. |
- Returns
- true if connected successfully, false otherwise.
◆ sendNetworkMessage
| bool TCPClient::sendNetworkMessage |
( |
QString | host, |
|
|
port_type | port, |
|
|
QByteArray const & | message, |
|
|
bool | crlf = true, |
|
|
int | msecs = 5000 ) |
|
slot |
Sends a network message to the specified host and port.
- Parameters
-
| host | The hostname or IP address to send the message to. |
| port | The port number to send the message to. |
| message | The message data to send. |
| crlf | Whether to append CRLF to the message. |
| msecs | The timeout in milliseconds to wait for the connection. |
- Returns
- true if the message was sent successfully, false otherwise.
The documentation for this class was generated from the following files: