Help using QUdpSocket in blocking mode without an event loop
Having problems using qudpsocket in blocking mode
My code is below, runs in a seperate thread
//get data from other thread
//code to process data
//then send out on wire qint64 n; n = s.writeDatagram( buffer, len, QHostAddress("........."), port); s.flush(); s.waitForBytesWritten(-1); if (len != n) qDebug() << "Error sending data << qPrintable(s.errorString());
The code was originally written using bsd sockets using sendto (socket.h) in blocking mode.
The writeDatagram function function sometimes fails with QAbstractSocket::NetworkError, however the original sendto never failed
I suppose the bottom line is how do I make the QUdpSocket writeDatagram function work like socket.h sendto function?
you could try waitForBytesWritten
"Your text to link here...":http://doc.qt.nokia.com/4.8-snapshot/qabstractsocket.html#waitForBytesWritten
Yes, if you look at the code you will see that I have tried that. What I dont understand is a way to make writeDatagram behave like socket.h function sendto in blocking mode.
Any help would be appreciated