bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor, LocalSocketState socketState, OpenMode openMode) { Q_D(QLocalSocket); d->pipeReader->stop(); d->handle = reinterpret_cast<HANDLE>(socketDescriptor); d->state = socketState; d->pipeReader->setHandle(d->handle); QIODevice::open(openMode); emit stateChanged(d->state); if (d->state == ConnectedState && openMode.testFlag(QIODevice::ReadOnly)) d->pipeReader->startAsyncRead(); return true; }
bool QLocalSocket::setSocketDescriptor(quintptr socketDescriptor, LocalSocketState socketState, OpenMode openMode) { Q_D(QLocalSocket); d->readBuffer.clear(); d->actualReadBufferSize = 0; QIODevice::open(openMode); d->handle = (int*)socketDescriptor; d->state = socketState; emit stateChanged(d->state); if (d->state == ConnectedState && openMode.testFlag(QIODevice::ReadOnly)) { d->startAsyncRead(); d->checkReadyRead(); } return true; }