CopperSpice API
1.9.1
|
The QTcpSocket class provides a TCP socket. More...
Public Methods | |
QTcpSocket (QObject *parent=nullptr) | |
virtual | ~QTcpSocket () |
Public Methods inherited from QAbstractSocket | |
QAbstractSocket (SocketType socketType, QObject *parent) | |
virtual | ~QAbstractSocket () |
void | abort () |
bool | atEnd () const override |
bool | bind (const QHostAddress &address, quint16 port=0, BindMode mode=DefaultForPlatform) |
bool | bind (quint16 port=0, BindMode mode=DefaultForPlatform) |
qint64 | bytesAvailable () const override |
qint64 | bytesToWrite () const override |
bool | canReadLine () const override |
void | close () override |
virtual void | connectToHost (const QHostAddress &address, quint16 port, OpenMode openMode=ReadWrite) |
virtual void | connectToHost (const QString &hostName, quint16 port, OpenMode openMode=ReadWrite, NetworkLayerProtocol protocol=AnyIPProtocol) |
virtual void | disconnectFromHost () |
SocketError | error () const |
bool | flush () |
bool | isSequential () const override |
bool | isValid () const |
QHostAddress | localAddress () const |
quint16 | localPort () const |
PauseModes | pauseMode () const |
QHostAddress | peerAddress () const |
QString | peerName () const |
quint16 | peerPort () const |
QNetworkProxy | proxy () const |
qint64 | readBufferSize () const |
virtual void | resume () |
void | setPauseMode (PauseModes pauseMode) |
void | setProxy (const QNetworkProxy &networkProxy) |
virtual void | setReadBufferSize (qint64 size) |
virtual bool | setSocketDescriptor (qintptr socketDescriptor, SocketState socketState=ConnectedState, OpenMode openMode=ReadWrite) |
virtual void | setSocketOption (QAbstractSocket::SocketOption option, const QVariant &value) |
virtual qintptr | socketDescriptor () const |
virtual QVariant | socketOption (QAbstractSocket::SocketOption option) |
SocketType | socketType () const |
SocketState | state () const |
bool | waitForBytesWritten (int msecs=30000) override |
virtual bool | waitForConnected (int msecs=30000) |
virtual bool | waitForDisconnected (int msecs=30000) |
bool | waitForReadyRead (int msecs=30000) override |
Public Methods inherited from QIODevice | |
QIODevice () | |
QIODevice (QObject *parent) | |
virtual | ~QIODevice () |
QString | errorString () const |
bool | getChar (char *c) |
bool | isOpen () const |
bool | isReadable () const |
bool | isTextModeEnabled () const |
bool | isWritable () const |
virtual bool | open (OpenMode mode) |
OpenMode | openMode () const |
qint64 | peek (char *data, qint64 maxSize) |
QByteArray | peek (qint64 maxSize) |
virtual qint64 | pos () const |
bool | putChar (char c) |
qint64 | read (char *data, qint64 maxSize) |
QByteArray | read (qint64 maxSize) |
QByteArray | readAll () |
qint64 | readLine (char *data, qint64 maxSize) |
QByteArray | readLine (qint64 maxSize=0) |
virtual bool | reset () |
virtual bool | seek (qint64 pos) |
void | setTextModeEnabled (bool enabled) |
virtual qint64 | size () const |
void | ungetChar (char c) |
qint64 | write (const char *data) |
qint64 | write (const char *data, qint64 maxSize) |
qint64 | write (const QByteArray &data) |
Public Methods inherited from QObject | |
QObject (QObject *parent=nullptr) | |
~QObject () | |
bool | blockSignals (bool block) |
const QList< QObject * > & | children () const |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QString > | dynamicPropertyNames () const |
virtual bool | event (QEvent *event) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
template<typename T > | |
T | findChild (const QString &childName=QString ()) const |
template<class T > | |
QList< T > | findChildren (const QRegularExpression ®Exp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
template<class T > | |
QList< T > | findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
bool | inherits (const QString &className) const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const |
bool | isWindowType () const |
void | killTimer (int id) |
const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const |
QObject * | parent () const |
template<class T = QVariant> | |
T | property (const QString &name) const |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const QString &name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
QThread * | thread () const |
Additional Inherited Members | |
Public Typedefs inherited from QAbstractSocket | |
using | BindMode = QFlags< BindFlag > |
using | PauseModes = QFlags< PauseMode > |
Public Typedefs inherited from QIODevice | |
using | OpenMode = QFlags< OpenModeFlag > |
Public Types inherited from QAbstractSocket | |
enum | BindFlag |
enum | NetworkLayerProtocol |
enum | PauseMode |
enum | SocketError |
enum | SocketOption |
enum | SocketState |
enum | SocketType |
Public Types inherited from QIODevice | |
enum | OpenModeFlag |
Public Signals inherited from QAbstractSocket | |
void | connected () |
void | disconnected () |
void | error (QAbstractSocket::SocketError socketError) |
void | hostFound () |
void | proxyAuthenticationRequired (const QNetworkProxy &proxy, QAuthenticator *authenticator) |
void | stateChanged (QAbstractSocket::SocketState socketState) |
Public Signals inherited from QIODevice | |
void | aboutToClose () |
void | bytesWritten (qint64 bytes) |
void | readChannelFinished () |
void | readyRead () |
Public Signals inherited from QObject | |
void | destroyed (QObject *obj=nullptr) |
void | objectNameChanged (const QString &objectName) |
Public Slots inherited from QObject | |
void | deleteLater () |
Static Public Methods inherited from QObject | |
static bool | connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ()) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...)) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod) |
static QMetaObject & | staticMetaObject () |
static QString | tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >()) |
Protected Methods inherited from QAbstractSocket | |
qint64 | readData (char *data, qint64 maxlen) override |
qint64 | readLineData (char *data, qint64 maxlen) override |
void | setLocalAddress (const QHostAddress &address) |
void | setLocalPort (quint16 port) |
void | setPeerAddress (const QHostAddress &address) |
void | setPeerName (const QString &name) |
void | setPeerPort (quint16 port) |
void | setSocketError (SocketError socketError) |
void | setSocketState (SocketState state) |
qint64 | writeData (const char *data, qint64 len) override |
Protected Methods inherited from QIODevice | |
void | setErrorString (const QString &errorString) |
void | setOpenMode (OpenMode openMode) |
Protected Methods inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signalMethod) const |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signalMethod) const |
bool | isSignalConnected (const QMetaMethod &signalMethod) const |
int | receivers (const QString &signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Properties inherited from QObject | |
objectName | |
Related Functions inherited from QObject | |
T | qobject_cast (QObject *object) |
QObjectList | |
The QTcpSocket class provides a TCP socket.
TCP (Transmission Control Protocol) is a reliable, stream-oriented, connection-oriented transport protocol. It is especially well suited for continuous transmission of data.
QTcpSocket is a convenience subclass of QAbstractSocket that allows you to establish a TCP connection and transfer streams of data. See the QAbstractSocket documentation for details.
|
explicit |
Creates a QTcpSocket object in state UnconnectedState
.
parent is passed on to the QObject constructor.
|
virtual |
Destroys the socket, closing the connection if necessary.