What's the default value for maxpendingconnections in windows?
I doubt if this really is the problem, since isn't count of connections the number of local sockets connected to the local server? Because the problem exists even though I only have single use local socket sending and receiving lot of packages from the server.
This is how my code looks like:
QLocalSocket
Initialization:
iSocket = new QLocalSocket(this);
iSocket->connectToServer(aCallbackAddress);
iSocket = new QLocalSocket(this);
iSocket->connectToServer(aCallbackAddress);
To copy to clipboard, switch view to plain text mode
Sending:
iSocket->flush();
int write = iSocket->write(aData.toAscii());
if (write == -1)
{
success = false;
}
iSocket->waitForBytesWritten(MSG_TIMEOUT);
iSocket->flush();
iSocket->flush();
int write = iSocket->write(aData.toAscii());
if (write == -1)
{
success = false;
}
iSocket->waitForBytesWritten(MSG_TIMEOUT);
iSocket->flush();
To copy to clipboard, switch view to plain text mode
Receiving:
QString data = iSocket->readAll();
To copy to clipboard, switch view to plain text mode
QLocalServer
Initialization:
iServer = new QLocalServer(this);
iSockets = new QMap<QLocalSocket*,QString>();
iServer->listen(aCallbackAddress);
connect(iServer, SIGNAL(newConnection()), SLOT(newConnectonHandle()));
iServer = new QLocalServer(this);
iSockets = new QMap<QLocalSocket*,QString>();
iServer->listen(aCallbackAddress);
connect(iServer, SIGNAL(newConnection()), SLOT(newConnectonHandle()));
To copy to clipboard, switch view to plain text mode
Sending:
if (socket->write(aData.toAscii()) == WRITE_ERROR)
{
success = false;
}
socket->waitForBytesWritten(MSG_TIMEOUT);
socket->flush();
if (socket->write(aData.toAscii()) == WRITE_ERROR)
{
success = false;
}
socket->waitForBytesWritten(MSG_TIMEOUT);
socket->flush();
To copy to clipboard, switch view to plain text mode
Receiving:
QLocalSocket* socket = 0;
for (int i=0; i < iSockets->keys().count(); i++)
{
if (iSockets->keys().at(i)->bytesAvailable() >= (int)sizeof(quint16))// Socket has some data to read
{
socket = iSockets->keys().at(i);
if (messageArgs.count()>2)
{
iSockets->insert(socket,messageArgs.at(2));
}
emit received(data);
}
}
QLocalSocket* socket = 0;
for (int i=0; i < iSockets->keys().count(); i++)
{
if (iSockets->keys().at(i)->bytesAvailable() >= (int)sizeof(quint16))// Socket has some data to read
{
socket = iSockets->keys().at(i);
QString data = socket->readAll();
QStringList messageArgs = data.split(MSG_DELIMETER);
if (messageArgs.count()>2)
{
iSockets->insert(socket,messageArgs.at(2));
}
emit received(data);
}
}
To copy to clipboard, switch view to plain text mode
Do you see anything out of place here?
Bookmarks