[Qt-interest] Why Bus error clientSocket->waitForConnected()?
Gabriele Kahlout
gabriele at mysimpatico.com
Sun May 2 00:57:07 CEST 2010
Okay. How about this?
int main(int argc, char ** argv){
QCoreApplication app(argc, argv);
int port = 55561;
QTcpServer qtcpServer;
if(!qtcpServer.listen(QHostAddress::LocalHost, port)){
std::cout<<" error" ;
}
qtcpServer.waitForNewConnection(-1);
QTcpSocket* socket = qtcpServer.nextPendingConnection();
socket->write(" hello from server \n" );
char buffer[50];
socket->readLine(buffer,50); // socket->bytesAvailable()
cout <<buffer;
return app.exec();
}
I connect to it through telnet and receive the hello. However, readLine
doesn't block. Just goes on. Why? The docuemntation says it's blocking.
2010/5/2 Thiago Macieira <thiago at kde.org>
> Em Sábado 1. Maio 2010, às 23.52.31, Gabriele Kahlout escreveu:
> > you guessed right, it's 0x0.
> >
> > While the reason seems evident to you, I think it's because my attempt to
> > reduce my multithreaded problem into a short main().
> > What is your reason?
>
> There was no call to waitForNewConnection.
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Senior Product Manager - Nokia, Qt Development Frameworks
> PGP/GPG: 0x6EF45358; fingerprint:
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
--
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/20100502/f713a244/attachment.html
More information about the Qt-interest-old
mailing list