JS8Call-Improved master
Loading...
Searching...
No Matches
TCPClient Class Reference
Inheritance diagram for TCPClient:
Collaboration diagram for TCPClient:

Public Types

using port_type = quint16

Public Slots

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.

Public Member Functions

 TCPClient (QObject *parent=nullptr)
 Construct a new TCPClient::TCPClient object.

Constructor & Destructor Documentation

◆ TCPClient()

TCPClient::TCPClient ( QObject * parent = nullptr)
explicit

Construct a new TCPClient::TCPClient object.

Parameters
parent

Member Function Documentation

◆ 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
hostThe hostname or IP address to connect to.
portThe port number to connect to.
msecsThe timeout in milliseconds to wait for the connection.
Returns
true if connected successfully, false otherwise.
Here is the caller graph for this function:

◆ 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
hostThe hostname or IP address to send the message to.
portThe port number to send the message to.
messageThe message data to send.
crlfWhether to append CRLF to the message.
msecsThe timeout in milliseconds to wait for the connection.
Returns
true if the message was sent successfully, false otherwise.
Here is the call graph for this function:

The documentation for this class was generated from the following files: