Auf dieser Seite

QTcpSocket Class

Die Klasse „QTcpSocket“ stellt einen TCP-Socket bereit. Mehr...

Header: #include <QTcpSocket>
CMake: find_package(Qt6 REQUIRED COMPONENTS Network)
target_link_libraries(mytarget PRIVATE Qt6::Network)
qmake: QT += network
Erbt von: QAbstractSocket
Vererbt an:

QSctpSocket und QSslSocket

Hinweis: Alle Funktionen dieser Klasse sind reentrant.

Öffentliche Funktionen

QTcpSocket(QObject *parent = nullptr)
virtual ~QTcpSocket()

Ausführliche Beschreibung

TCP (Transmission Control Protocol) ist ein zuverlässiges, stromorientiertes und verbindungsorientiertes Transportprotokoll. Es eignet sich besonders gut für die kontinuierliche Datenübertragung.

QTcpSocket ist eine Komfort-Unterklasse von „ QAbstractSocket “, mit der Sie eine TCP-Verbindung herstellen und Datenströme übertragen können. Weitere Informationen finden Sie in der Dokumentation zu „ QAbstractSocket “.

Hinweis: TCP-Sockets können nicht im Modus „ QIODeviceBase::Unbuffered “ geöffnet werden.

Siehe auch „ QTcpServer“ , „ QUdpSocket “, „ QNetworkAccessManager “, „Fortune Server“, „Fortune Client“, „Threaded Fortune Server“, „Blocking Fortune Client“ und „Torrent-Beispiel“.

Dokumentation zu Mitgliedsfunktionen

[explicit] QTcpSocket::QTcpSocket(QObject *parent = nullptr)

Erstellt ein QTcpSocket-Objekt im Zustand „ UnconnectedState “.

parent wird an den Konstruktor „ QObject “ übergeben.

Siehe auch socketType().

[virtual noexcept] QTcpSocket::~QTcpSocket()

Löscht den Socket und schließt gegebenenfalls die Verbindung.

Siehe auch close().

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.