[Qt-interest] Why Bus error clientSocket->waitForConnected()?

Gabriele Kahlout gabriele at mysimpatico.com
Sat May 1 21:52:52 CEST 2010


Hello,

The code below should illustrate a problem I'm having with my code. In my
code I get the bus error after waiting for some time (ca. 30 secs) on
something similar to assert(serverSocket->waitForReadyRead());.

#include <QtCore/QCoreApplication>
#include <assert.h>
#include <QtNetwork/QTcpServer>
#include <QtNetwork/QTcpSocket>


int main(int argc, char *argv[]){
    QCoreApplication a(argc, argv);

    int port = 55561; //not a port # issue.
    QTcpServer *server = new QTcpServer();

    assert(server->listen(QHostAddress::LocalHost, port));

    QTcpSocket* clientSocket = new QTcpSocket();
    clientSocket->connectToHost(QHostAddress::LocalHost, port);
    assert(clientSocket->waitForConnected());

    QTcpSocket* serverSocket = server->nextPendingConnection();

    assert(serverSocket->waitForReadyRead());


    return a.exec();
}


-- 
Regards,
K. Gabriele

--- unchanged since 25/1/10 ---
P.S. Unless a notification (LON), please reply either with an answer OR with
" ACK" appended to this subject within 48 hours. Otherwise, I might resend.
In(LON, this) ∨ In(48h, TimeNow) ∨ ∃x. In(x, MyInbox) ∧ IsAnswerTo(x, this)
∨ (In(subject(this), subject(x)) ∧ In(ACK, subject(x)) ∧
¬IsAnswerTo(x,this)) ⇒ ¬IResend(this).

Also note that correspondence may be received only from specified a priori
senders, or if the subject of this email ends with a code, eg. -LICHT01X,
then also from senders whose reply contains it.
∀x. In(x, MyInbox) ⇒ In(senderAddress(x), MySafeSenderList) ∨ (∃y. In(y,
subject(this) ) ∧ In(y,x) ∧ isCodeLike(y, -LICHT01X) ).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100501/7b81ca84/attachment.html 


More information about the Qt-interest-old mailing list