Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QAbstractSocketPrivate Class Reference

#include <qabstractsocket_p.h>

Inheritance diagram for QAbstractSocketPrivate:
Collaboration diagram for QAbstractSocketPrivate:

Public Member Functions

 QAbstractSocketPrivate (decltype(QObjectPrivateVersion) version=QObjectPrivateVersion)
virtual ~QAbstractSocketPrivate ()
void readNotification () override
void writeNotification () override
void exceptionNotification () override
void closeNotification () override
void connectionNotification () override
void proxyAuthenticationRequired (const QNetworkProxy &proxy, QAuthenticator *authenticator) override
virtual bool bind (const QHostAddress &address, quint16 port, QAbstractSocket::BindMode mode, const QNetworkInterface *iface=nullptr)
virtual bool canReadNotification ()
bool canWriteNotification ()
void canCloseNotification ()
void _q_connectToNextAddress ()
void _q_startConnecting (const QHostInfo &hostInfo)
void _q_testConnection ()
void _q_abortConnectionAttempt ()
void resolveProxy (const QString &hostName, quint16 port)
void resolveProxy (quint16 port)
void resetSocketLayer ()
virtual bool flush ()
bool initSocketLayer (QAbstractSocket::NetworkLayerProtocol protocol)
virtual void configureCreatedSocket ()
void startConnectingByName (const QString &host)
void fetchConnectionParameters ()
bool readFromSocket ()
virtual bool writeToSocket ()
void emitReadyRead (int channel=0)
void emitBytesWritten (qint64 bytes, int channel=0)
void setError (QAbstractSocket::SocketError errorCode, const QString &errorString)
void setErrorAndEmit (QAbstractSocket::SocketError errorCode, const QString &errorString)
Public Member Functions inherited from QIODevicePrivate
 QIODevicePrivate (decltype(QObjectPrivateVersion) version=QObjectPrivateVersion)
virtual ~QIODevicePrivate ()
virtual bool putCharHelper (char c)
bool isSequential () const
bool isBufferEmpty () const
bool allWriteBuffersEmpty () const
void seekBuffer (qint64 newPos)
void setCurrentReadChannel (int channel)
void setCurrentWriteChannel (int channel)
void setReadChannelCount (int count)
void setWriteChannelCount (int count)
qint64 read (char *data, qint64 maxSize, bool peeking=false)
qint64 readLine (char *data, qint64 maxSize, ReadLineOption option=ReadLineOption::NullTerminated)
virtual qint64 peek (char *data, qint64 maxSize)
virtual QByteArray peek (qint64 maxSize)
qint64 skipByReading (qint64 maxSize)
qint64 skipLine ()
void write (const char *data, qint64 size)
bool isWriteChunkCached (const char *data, qint64 size) const
Public Member Functions inherited from QObjectPrivate
void ensureExtraData ()
void setObjectNameWithoutBindings (const QString &name)
 QObjectPrivate (decltype(QObjectPrivateVersion) version=QObjectPrivateVersion)
virtual ~QObjectPrivate ()
void deleteChildren ()
void clearBindingStorage ()
void setParent_helper (QObject *)
void moveToThread_helper ()
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData, QBindingStatus *status)
QObjectList receiverList (const char *signal) const
void ensureConnectionData ()
void addConnection (int signal, Connection *c)
int signalIndex (const char *signalName, const QMetaObject **meta=nullptr) const
bool isSignalConnected (uint signalIdx, bool checkDeclarative=true) const
bool maybeSignalConnected (uint signalIndex) const
bool isDeclarativeSignalConnected (uint signalIdx) const
void connectNotify (const QMetaMethod &signal)
void disconnectNotify (const QMetaMethod &signal)
void reinitBindingStorageAfterThreadMove ()
virtual std::string flagsForDumping () const
virtual void writeToDebugStream (QDebug &) const
QtPrivate::QPropertyAdaptorSlotObjectgetPropertyAdaptorSlotObject (const QMetaProperty &property)
Public Member Functions inherited from QObjectData
 QObjectData ()=default
virtual ~QObjectData ()=0
const QMetaObjectdynamicMetaObject () const
Public Member Functions inherited from QAbstractSocketEngineReceiver
virtual ~QAbstractSocketEngineReceiver ()

Static Public Member Functions

static void pauseSocketNotifiers (QAbstractSocket *)
static void resumeSocketNotifiers (QAbstractSocket *)
static QAbstractSocketEnginegetSocketEngine (QAbstractSocket *)
Static Public Member Functions inherited from QObjectPrivate
static bool removeConnection (Connection *c)
static QObjectPrivateget (QObject *o)
static const QObjectPrivateget (const QObject *o)
template<typename Func1, typename Func2>
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
template<typename Func1, typename Func2>
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
static QMetaObject::Connection connectImpl (const QObject *sender, int signal_index, const QObject *receiver, void **slot, QtPrivate::QSlotObjectBase *slotObj, int type, const int *types, const QMetaObject *senderMetaObject)
static QMetaObject::Connection connect (const QObject *sender, int signal_index, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type)
static QMetaObject::Connection connect (const QObject *sender, int signal_index, const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type)
static bool disconnect (const QObject *sender, int signal_index, void **slot)
static bool disconnect (const QObject *sender, int signal_index, const QObject *receiver, void **slot)

Public Attributes

bool emittedReadyRead = false
bool emittedBytesWritten = false
bool abortCalled = false
bool pendingClose = false
QAbstractSocket::PauseModes pauseMode = QAbstractSocket::PauseNever
QString hostName
quint16 port = 0
QHostAddress host
QList< QHostAddressaddresses
quint16 localPort = 0
quint16 peerPort = 0
QHostAddress localAddress
QHostAddress peerAddress
QString peerName
QAbstractSocketEnginesocketEngine = nullptr
qintptr cachedSocketDescriptor = -1
QNetworkProxy proxy
QNetworkProxy proxyInUse
QString protocolTag
qint64 readBufferMaxSize = 0
bool isBuffered = false
bool hasPendingData = false
bool hasPendingDatagram = false
QTimerconnectTimer = nullptr
int hostLookupId = -1
QAbstractSocket::SocketType socketType = QAbstractSocket::UnknownSocketType
QAbstractSocket::SocketState state = QAbstractSocket::UnconnectedState
QAbstractSocket::SocketError socketError = QAbstractSocket::UnknownSocketError
QAbstractSocket::NetworkLayerProtocol preferredNetworkLayerProtocol
bool prePauseReadSocketNotifierState = false
bool prePauseWriteSocketNotifierState = false
bool prePauseExceptionSocketNotifierState = false
Public Attributes inherited from QIODevicePrivate
qint64 pos = 0
qint64 devicePos = 0
qint64 transactionPos = 0
QRingBufferRef buffer
QRingBufferRef writeBuffer
const QByteArraycurrentWriteChunk = nullptr
int readChannelCount = 0
int writeChannelCount = 0
int currentReadChannel = 0
int currentWriteChannel = 0
int readBufferChunkSize = QIODEVICE_BUFFERSIZE
int writeBufferChunkSize = 0
QVarLengthArray< QRingBuffer, 2 > readBuffers
QVarLengthArray< QRingBuffer, 1 > writeBuffers
QString errorString
QIODevice::OpenMode openMode = QIODevice::NotOpen
bool transactionStarted = false
bool baseReadLineDataCalled = false
AccessMode accessMode = Unset
Public Attributes inherited from QObjectPrivate
ExtraDataextraData
QAtomicPointer< QThreadDatathreadData
QAtomicPointer< ConnectionDataconnections
union { 
   QObject *   currentChildBeingDeleted 
   QAbstractDeclarativeData *   declarativeData 
}; 
QAtomicPointer< QtSharedPointer::ExternalRefCountDatasharedRefcount
Public Attributes inherited from QObjectData
QObjectq_ptr
QObjectparent
QObjectList children
uint isWidget: 1
uint blockSig: 1
uint wasDeleted: 1
uint isDeletingChildren: 1
uint sendChildEvents: 1
uint receiveChildEvents: 1
uint isWindow: 1
uint deleteLaterCalled: 1
uint isQuickItem: 1
uint willBeWidget: 1
uint wasWidget: 1
uint receiveParentEvents: 1
uint unused: 20
QAtomicInt postedEvents
QDynamicMetaObjectDatametaObject
QBindingStorage bindingStorage

Additional Inherited Members

Public Types inherited from QIODevicePrivate
enum class  ReadLineOption { NotNullTerminated , NullTerminated }
enum  AccessMode : quint8 { Unset , Sequential , RandomAccess }
Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
using ConnectionDataPointer = QExplicitlySharedDataPointer<ConnectionData>

Detailed Description

Definition at line 33 of file qabstractsocket_p.h.

Constructor & Destructor Documentation

◆ QAbstractSocketPrivate()

QAbstractSocketPrivate::QAbstractSocketPrivate ( decltype(QObjectPrivateVersion) version = QObjectPrivateVersion)

Constructs a QAbstractSocketPrivate. Initializes all members.

Definition at line 497 of file qabstractsocket.cpp.

◆ ~QAbstractSocketPrivate()

QAbstractSocketPrivate::~QAbstractSocketPrivate ( )
virtual

Destructs the QAbstractSocket. If the socket layer is open, it will be reset.

Definition at line 508 of file qabstractsocket.cpp.

Member Function Documentation

◆ _q_abortConnectionAttempt()

void QAbstractSocketPrivate::_q_abortConnectionAttempt ( )

This function is called after a certain number of seconds has passed while waiting for a connection. It simply tests the connection, and continues to the next address if the connection failed.

Definition at line 1124 of file qabstractsocket.cpp.

◆ _q_connectToNextAddress()

void QAbstractSocketPrivate::_q_connectToNextAddress ( )

Called by a queued or direct connection from _q_startConnecting() or _q_testConnection(), this function takes the first address of the pending addresses list and tries to connect to it. If the connection succeeds, QAbstractSocket will emit connected(). Otherwise, errorOccurred(ConnectionRefusedError) or errorOccurred(SocketTimeoutError) is emitted.

Definition at line 998 of file qabstractsocket.cpp.

◆ _q_startConnecting()

void QAbstractSocketPrivate::_q_startConnecting ( const QHostInfo & hostInfo)

Slot connected to QHostInfo::lookupHost() in connectToHost(). This function starts the process of connecting to any number of candidate IP addresses for the host, if it was found. Calls _q_connectToNextAddress().

Definition at line 926 of file qabstractsocket.cpp.

◆ _q_testConnection()

void QAbstractSocketPrivate::_q_testConnection ( )

Tests if a connection has been established. If it has, connected() is emitted. Otherwise, _q_connectToNextAddress() is invoked.

Definition at line 1088 of file qabstractsocket.cpp.

◆ bind()

bool QAbstractSocketPrivate::bind ( const QHostAddress & address,
quint16 port,
QAbstractSocket::BindMode mode,
const QNetworkInterface * iface = nullptr )
virtual

Reimplemented in QSslSocketPrivate.

Definition at line 1503 of file qabstractsocket.cpp.

◆ canCloseNotification()

void QAbstractSocketPrivate::canCloseNotification ( )

Slot connected to the close socket notifier. It's called when the socket is closed.

Definition at line 675 of file qabstractsocket.cpp.

◆ canReadNotification()

bool QAbstractSocketPrivate::canReadNotification ( )
virtual

Slot connected to the read socket notifier. This slot is called when new data is available for reading, or when the socket has been closed. Handles recursive calls.

Reimplemented in QSctpSocketPrivate.

Definition at line 607 of file qabstractsocket.cpp.

◆ canWriteNotification()

bool QAbstractSocketPrivate::canWriteNotification ( )

Slot connected to the write socket notifier. It's called during a delayed connect or when the socket is ready for writing.

Definition at line 719 of file qabstractsocket.cpp.

◆ closeNotification()

void QAbstractSocketPrivate::closeNotification ( )
inlineoverridevirtual

Implements QAbstractSocketEngineReceiver.

Definition at line 45 of file qabstractsocket_p.h.

◆ configureCreatedSocket()

void QAbstractSocketPrivate::configureCreatedSocket ( )
virtual

Reimplemented in QSctpSocketPrivate.

Definition at line 591 of file qabstractsocket.cpp.

◆ connectionNotification()

void QAbstractSocketPrivate::connectionNotification ( )
overridevirtual

Slot connected to a notification of connection status change. Either we finished connecting or we failed to connect.

Implements QAbstractSocketEngineReceiver.

Definition at line 733 of file qabstractsocket.cpp.

◆ emitBytesWritten()

void QAbstractSocketPrivate::emitBytesWritten ( qint64 bytes,
int channel = 0 )

Emits bytesWritten(), protecting against recursion.

Definition at line 1233 of file qabstractsocket.cpp.

◆ emitReadyRead()

void QAbstractSocketPrivate::emitReadyRead ( int channel = 0)

Emits readyRead(), protecting against recursion.

Definition at line 1216 of file qabstractsocket.cpp.

◆ exceptionNotification()

void QAbstractSocketPrivate::exceptionNotification ( )
inlineoverridevirtual

Implements QAbstractSocketEngineReceiver.

Definition at line 44 of file qabstractsocket_p.h.

◆ fetchConnectionParameters()

void QAbstractSocketPrivate::fetchConnectionParameters ( )

Sets up the internal state after the connection has succeeded.

Definition at line 1250 of file qabstractsocket.cpp.

◆ flush()

bool QAbstractSocketPrivate::flush ( )
virtual

Writes pending data in the write buffers to the socket. The function writes as much as it can without blocking. If any data was written, this function returns true; otherwise false is returned.

Reimplemented in QSslSocketPrivate.

Definition at line 818 of file qabstractsocket.cpp.

Referenced by testing.tools.encode_pdf_filter._SinkPdfStream::close().

Here is the caller graph for this function:

◆ getSocketEngine()

QAbstractSocketEngine * QAbstractSocketPrivate::getSocketEngine ( QAbstractSocket * socket)
static

Definition at line 1355 of file qabstractsocket.cpp.

◆ initSocketLayer()

bool QAbstractSocketPrivate::initSocketLayer ( QAbstractSocket::NetworkLayerProtocol protocol)

Initializes the socket layer to by of type type, using the network layer protocol protocol. Resets the socket layer first if it's already initialized. Sets up the socket notifiers.

Definition at line 540 of file qabstractsocket.cpp.

◆ pauseSocketNotifiers()

void QAbstractSocketPrivate::pauseSocketNotifiers ( QAbstractSocket * socket)
static

Definition at line 1305 of file qabstractsocket.cpp.

◆ proxyAuthenticationRequired()

void QAbstractSocketPrivate::proxyAuthenticationRequired ( const QNetworkProxy & proxy,
QAuthenticator * authenticator )
inlineoverridevirtual

Implements QAbstractSocketEngineReceiver.

Definition at line 48 of file qabstractsocket_p.h.

◆ readFromSocket()

bool QAbstractSocketPrivate::readFromSocket ( )

Reads data from the socket layer into the read buffer. Returns true on success; otherwise false.

Definition at line 1151 of file qabstractsocket.cpp.

◆ readNotification()

void QAbstractSocketPrivate::readNotification ( )
inlineoverridevirtual

Implements QAbstractSocketEngineReceiver.

Definition at line 42 of file qabstractsocket_p.h.

◆ resetSocketLayer()

void QAbstractSocketPrivate::resetSocketLayer ( )

Resets the socket layer and deletes any socket notifiers.

Definition at line 516 of file qabstractsocket.cpp.

◆ resolveProxy() [1/2]

void QAbstractSocketPrivate::resolveProxy ( const QString & hostname,
quint16 port )

Resolve the proxy to its final value.

Definition at line 833 of file qabstractsocket.cpp.

◆ resolveProxy() [2/2]

void QAbstractSocketPrivate::resolveProxy ( quint16 port)
inline

Definition at line 97 of file qabstractsocket_p.h.

◆ resumeSocketNotifiers()

void QAbstractSocketPrivate::resumeSocketNotifiers ( QAbstractSocket * socket)
static

Definition at line 1335 of file qabstractsocket.cpp.

◆ setError()

void QAbstractSocketPrivate::setError ( QAbstractSocket::SocketError errorCode,
const QString & errStr )

Sets the socket error state to errorCode and errorString.

Definition at line 1365 of file qabstractsocket.cpp.

◆ setErrorAndEmit()

void QAbstractSocketPrivate::setErrorAndEmit ( QAbstractSocket::SocketError errorCode,
const QString & errorString )

Sets the socket error state to errorCode and errorString, and emits the QAbstractSocket::errorOccurred() signal.

Definition at line 1378 of file qabstractsocket.cpp.

◆ startConnectingByName()

void QAbstractSocketPrivate::startConnectingByName ( const QString & host)

Starts the connection to host, like _q_startConnecting below, but without hostname resolution.

Definition at line 882 of file qabstractsocket.cpp.

◆ writeNotification()

void QAbstractSocketPrivate::writeNotification ( )
inlineoverridevirtual

Implements QAbstractSocketEngineReceiver.

Definition at line 43 of file qabstractsocket_p.h.

◆ writeToSocket()

bool QAbstractSocketPrivate::writeToSocket ( )
virtual

Writes one pending data block in the write buffer to the socket.

It is usually invoked by canWriteNotification after one or more calls to write().

Emits bytesWritten().

Reimplemented in QSctpSocketPrivate.

Definition at line 754 of file qabstractsocket.cpp.

Member Data Documentation

◆ abortCalled

bool QAbstractSocketPrivate::abortCalled = false

Definition at line 70 of file qabstractsocket_p.h.

◆ addresses

QList<QHostAddress> QAbstractSocketPrivate::addresses

Definition at line 78 of file qabstractsocket_p.h.

◆ cachedSocketDescriptor

qintptr QAbstractSocketPrivate::cachedSocketDescriptor = -1

Definition at line 87 of file qabstractsocket_p.h.

◆ connectTimer

QTimer* QAbstractSocketPrivate::connectTimer = nullptr

Definition at line 119 of file qabstractsocket_p.h.

◆ emittedBytesWritten

bool QAbstractSocketPrivate::emittedBytesWritten = false

Definition at line 68 of file qabstractsocket_p.h.

◆ emittedReadyRead

bool QAbstractSocketPrivate::emittedReadyRead = false

Definition at line 67 of file qabstractsocket_p.h.

◆ hasPendingData

bool QAbstractSocketPrivate::hasPendingData = false

Definition at line 116 of file qabstractsocket_p.h.

◆ hasPendingDatagram

bool QAbstractSocketPrivate::hasPendingDatagram = false

Definition at line 117 of file qabstractsocket_p.h.

◆ host

QHostAddress QAbstractSocketPrivate::host

Definition at line 77 of file qabstractsocket_p.h.

◆ hostLookupId

int QAbstractSocketPrivate::hostLookupId = -1

Definition at line 121 of file qabstractsocket_p.h.

◆ hostName

QString QAbstractSocketPrivate::hostName

Definition at line 75 of file qabstractsocket_p.h.

◆ isBuffered

bool QAbstractSocketPrivate::isBuffered = false

Definition at line 115 of file qabstractsocket_p.h.

◆ localAddress

QHostAddress QAbstractSocketPrivate::localAddress

Definition at line 82 of file qabstractsocket_p.h.

◆ localPort

quint16 QAbstractSocketPrivate::localPort = 0

Definition at line 80 of file qabstractsocket_p.h.

◆ pauseMode

QAbstractSocket::PauseModes QAbstractSocketPrivate::pauseMode = QAbstractSocket::PauseNever

Definition at line 73 of file qabstractsocket_p.h.

◆ peerAddress

QHostAddress QAbstractSocketPrivate::peerAddress

Definition at line 83 of file qabstractsocket_p.h.

◆ peerName

QString QAbstractSocketPrivate::peerName

Definition at line 84 of file qabstractsocket_p.h.

◆ peerPort

quint16 QAbstractSocketPrivate::peerPort = 0

Definition at line 81 of file qabstractsocket_p.h.

◆ pendingClose

bool QAbstractSocketPrivate::pendingClose = false

Definition at line 71 of file qabstractsocket_p.h.

◆ port

quint16 QAbstractSocketPrivate::port = 0

Definition at line 76 of file qabstractsocket_p.h.

◆ preferredNetworkLayerProtocol

QAbstractSocket::NetworkLayerProtocol QAbstractSocketPrivate::preferredNetworkLayerProtocol
Initial value:

Definition at line 129 of file qabstractsocket_p.h.

◆ prePauseExceptionSocketNotifierState

bool QAbstractSocketPrivate::prePauseExceptionSocketNotifierState = false

Definition at line 134 of file qabstractsocket_p.h.

◆ prePauseReadSocketNotifierState

bool QAbstractSocketPrivate::prePauseReadSocketNotifierState = false

Definition at line 132 of file qabstractsocket_p.h.

◆ prePauseWriteSocketNotifierState

bool QAbstractSocketPrivate::prePauseWriteSocketNotifierState = false

Definition at line 133 of file qabstractsocket_p.h.

◆ protocolTag

QString QAbstractSocketPrivate::protocolTag

Definition at line 92 of file qabstractsocket_p.h.

◆ proxy

QNetworkProxy QAbstractSocketPrivate::proxy

Definition at line 90 of file qabstractsocket_p.h.

◆ proxyInUse

QNetworkProxy QAbstractSocketPrivate::proxyInUse

Definition at line 91 of file qabstractsocket_p.h.

◆ readBufferMaxSize

qint64 QAbstractSocketPrivate::readBufferMaxSize = 0

Definition at line 114 of file qabstractsocket_p.h.

◆ socketEngine

QAbstractSocketEngine* QAbstractSocketPrivate::socketEngine = nullptr

Definition at line 86 of file qabstractsocket_p.h.

◆ socketError

Definition at line 127 of file qabstractsocket_p.h.

◆ socketType

Definition at line 123 of file qabstractsocket_p.h.

◆ state

Definition at line 124 of file qabstractsocket_p.h.


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