| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/socket/qtcpsocket.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count |
|---|---|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - |
| 4 | ** Contact: https://www.qt.io/licensing/ | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtNetwork module of the Qt Toolkit. | - |
| 7 | ** | - |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
| 9 | ** Commercial License Usage | - |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
| 11 | ** accordance with the commercial license agreement provided with the | - |
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - |
| 16 | ** | - |
| 17 | ** GNU Lesser General Public License Usage | - |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
| 19 | ** General Public License version 3 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - |
| 24 | ** | - |
| 25 | ** GNU General Public License Usage | - |
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - |
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - |
| 31 | ** included in the packaging of this file. Please review the following | - |
| 32 | ** information to ensure the GNU General Public License requirements will | - |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - |
| 35 | ** | - |
| 36 | ** $QT_END_LICENSE$ | - |
| 37 | ** | - |
| 38 | ****************************************************************************/ | - |
| 39 | - | |
| 40 | //#define QTCPSOCKET_DEBUG | - |
| 41 | - | |
| 42 | /*! | - |
| 43 | \class QTcpSocket | - |
| 44 | - | |
| 45 | \brief The QTcpSocket class provides a TCP socket. | - |
| 46 | - | |
| 47 | \reentrant | - |
| 48 | \ingroup network | - |
| 49 | \inmodule QtNetwork | - |
| 50 | - | |
| 51 | TCP (Transmission Control Protocol) is a reliable, | - |
| 52 | stream-oriented, connection-oriented transport protocol. It is | - |
| 53 | especially well suited for continuous transmission of data. | - |
| 54 | - | |
| 55 | QTcpSocket is a convenience subclass of QAbstractSocket that | - |
| 56 | allows you to establish a TCP connection and transfer streams of | - |
| 57 | data. See the QAbstractSocket documentation for details. | - |
| 58 | - | |
| 59 | \note TCP sockets cannot be opened in QIODevice::Unbuffered mode. | - |
| 60 | - | |
| 61 | \sa QTcpServer, QUdpSocket, QNetworkAccessManager, | - |
| 62 | {Fortune Server Example}, {Fortune Client Example}, | - |
| 63 | {Threaded Fortune Server Example}, {Blocking Fortune Client Example}, | - |
| 64 | {Loopback Example}, {Torrent Example} | - |
| 65 | */ | - |
| 66 | - | |
| 67 | #include "qtcpsocket.h" | - |
| 68 | #include "qtcpsocket_p.h" | - |
| 69 | #include "qlist.h" | - |
| 70 | #include "qhostaddress.h" | - |
| 71 | - | |
| 72 | QT_BEGIN_NAMESPACE | - |
| 73 | - | |
| 74 | /*! | - |
| 75 | Creates a QTcpSocket object in state \c UnconnectedState. | - |
| 76 | - | |
| 77 | \a parent is passed on to the QObject constructor. | - |
| 78 | - | |
| 79 | \sa socketType() | - |
| 80 | */ | - |
| 81 | QTcpSocket::QTcpSocket(QObject *parent) | - |
| 82 | : QAbstractSocket(TcpSocket, *new QTcpSocketPrivate, parent) | - |
| 83 | { | - |
| 84 | #if defined(QTCPSOCKET_DEBUG) | - |
| 85 | qDebug("QTcpSocket::QTcpSocket()"); | - |
| 86 | #endif | - |
| 87 | d_func()->isBuffered = true; | - |
| 88 | } executed 8112 times by 31 tests: end of blockExecuted by:
| 8112 |
| 89 | - | |
| 90 | /*! | - |
| 91 | Destroys the socket, closing the connection if necessary. | - |
| 92 | - | |
| 93 | \sa close() | - |
| 94 | */ | - |
| 95 | - | |
| 96 | QTcpSocket::~QTcpSocket() | - |
| 97 | { | - |
| 98 | #if defined(QTCPSOCKET_DEBUG) | - |
| 99 | qDebug("QTcpSocket::~QTcpSocket()"); | - |
| 100 | #endif | - |
| 101 | } | - |
| 102 | - | |
| 103 | /*! | - |
| 104 | \internal | - |
| 105 | */ | - |
| 106 | QTcpSocket::QTcpSocket(QTcpSocketPrivate &dd, QObject *parent) | - |
| 107 | : QAbstractSocket(TcpSocket, dd, parent) | - |
| 108 | { | - |
| 109 | d_func()->isBuffered = true; | - |
| 110 | } executed 720 times by 8 tests: end of blockExecuted by:
| 720 |
| 111 | - | |
| 112 | /*! | - |
| 113 | \internal | - |
| 114 | */ | - |
| 115 | QTcpSocket::QTcpSocket(QAbstractSocket::SocketType socketType, | - |
| 116 | QTcpSocketPrivate &dd, QObject *parent) | - |
| 117 | : QAbstractSocket(socketType, dd, parent) | - |
| 118 | { | - |
| 119 | } never executed: end of block | 0 |
| 120 | - | |
| 121 | QT_END_NAMESPACE | - |
| Source code | Switch to Preprocessed file |