44 #include <QtCore/qplugin.h> 45 #include <QtNetwork/qtcpserver.h> 46 #include <QtNetwork/qtcpsocket.h> 48 #include <private/qdeclarativedebugserver_p.h> 49 #include <private/qpacketprotocol_p.h> 104 || !
d->protocol || !
d->socket)
110 d->protocol->send(pack);
119 d->protocol->deleteLater();
121 d->socket->deleteLater();
128 if (
d->protocol->packetsAvailable() > 0) {
129 QPacket packet =
d->protocol->read();
130 d->debugServer->receiveMessage(packet.
data());
133 return d->protocol->waitForReadyRead(-1);
145 d->tcpServer->waitForNewConnection(-1);
155 qDebug(
"QDeclarativeDebugServer: Waiting for connection on port %d...",
d->port);
157 qWarning(
"QDeclarativeDebugServer: Unable to listen on port %d",
d->port);
168 while (
d->protocol->packetsAvailable() > 0) {
169 QPacket packet =
d->protocol->read();
170 d->debugServer->receiveMessage(packet.
data());
179 qWarning(
"QDeclarativeDebugServer: Another client is already connected");
180 QTcpSocket *faultyConnection =
d->tcpServer->nextPendingConnection();
181 delete faultyConnection;
185 d->socket =
d->tcpServer->nextPendingConnection();
186 d->socket->setParent(
this);
191 d->protocol->waitForReadyRead(-1);
#define QT_END_NAMESPACE
This macro expands to.
char * data()
Returns a pointer to the data stored in the byte array.
The QByteArray class provides an array of bytes.
The QPacketProtocol class encapsulates communicating discrete packets across fragmented IO channels...
The QPacket class encapsulates an unfragmentable packet of data to be transmitted by QPacketProtocol...
void send(const QByteArray &message)
Q_CORE_EXPORT void qDebug(const char *,...)
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setServer(QDeclarativeDebugServer *server)
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Q_CORE_EXPORT void qWarning(const char *,...)
QByteArray data() const
Returns raw packet data.
The QTcpSocket class provides a TCP socket.
QTcpServerConnectionPrivate()
QDeclarativeDebugServer * debugServer
int length() const
Same as size().
static QAuServer & server()
The QTcpServer class provides a TCP-based server.
void setPort(int port, bool bock)
QPacketProtocol * protocol
QTcpServerConnectionPrivate * d_ptr
int writeRawData(const char *, int len)
Writes len bytes from s to the stream.
#define Q_EXPORT_PLUGIN2(PLUGIN, PLUGINCLASS)