bool QNativeSocketEnginePrivate::nativeListen(int backlog) { if (qt_socket_listen(socketDescriptor, backlog) < 0) { switch (errno) { case EADDRINUSE: setError(QAbstractSocket::AddressInUseError, PortInuseErrorString); break; default: break; } #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativeListen(%i) == false (%s)", backlog, socketErrorString.toLatin1().constData()); #endif return false; } #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativeListen(%i) == true", backlog); #endif socketState = QAbstractSocket::ListeningState; return true; }
/*! Specifies how many pending connections a server socket can have. Returns true if the operation was successful; otherwise returns false. A \a backlog value of 50 is quite common. The listen() call only applies to sockets where type() is \c Stream, i.e. not to \c Datagram sockets. listen() must not be called before bind() or after accept(). \sa bind(), accept() */ bool MSocketDevice::listen( int backlog ) { if ( !isValid() ) return false; if ( qt_socket_listen( fd, backlog ) >= 0 ) return true; if ( !e ) e = Impossible; return false; }