diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-02-25 16:52:04 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2011-02-25 17:17:39 (GMT) |
commit | a722a716641d596b9a799e776e81167a47a261fa (patch) | |
tree | 3715bd84680310970343d4a9a52b8a9d5a600bbe /src | |
parent | 88e192419ed928be1239d7a928336332f1d521f4 (diff) | |
download | Qt-a722a716641d596b9a799e776e81167a47a261fa.zip Qt-a722a716641d596b9a799e776e81167a47a261fa.tar.gz Qt-a722a716641d596b9a799e776e81167a47a261fa.tar.bz2 |
Fix for read on "connected" UDP sockets
Symbian API RecvOneOrMore only supports stream oriented sockets.
So for UDP we use RecvFrom instead and discard the source address.
Reviewed-by: Markus Goetz
Diffstat (limited to 'src')
-rw-r--r-- | src/network/socket/qsymbiansocketengine.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/network/socket/qsymbiansocketengine.cpp b/src/network/socket/qsymbiansocketengine.cpp index b9537c1..e3b4a09 100644 --- a/src/network/socket/qsymbiansocketengine.cpp +++ b/src/network/socket/qsymbiansocketengine.cpp @@ -1049,10 +1049,16 @@ qint64 QSymbianSocketEngine::read(char *data, qint64 maxSize) TPtr8 buffer((TUint8*)data, (int)maxSize); TSockXfrLength received = 0; TRequestStatus status; - d->nativeSocket.RecvOneOrMore(buffer, 0, status, received); + TSockAddr dummy; + if (d->socketType == QAbstractSocket::UdpSocket) { + //RecvOneOrMore() can only be used with stream-interfaced connected sockets; datagram interface sockets will return KErrNotSupported. + d->nativeSocket.RecvFrom(buffer, dummy, 0, status); + } else { + d->nativeSocket.RecvOneOrMore(buffer, 0, status, received); + } User::WaitForRequest(status); //Non blocking receive TInt err = status.Int(); - int r = received(); + int r = buffer.Length(); if (err == KErrWouldBlock) { // No data was available for reading @@ -1064,9 +1070,9 @@ qint64 QSymbianSocketEngine::read(char *data, qint64 maxSize) } #if defined (QNATIVESOCKETENGINE_DEBUG) - qDebug("QSymbianSocketEngine::read(%p \"%s\", %llu) == %i", + qDebug("QSymbianSocketEngine::read(%p \"%s\", %llu) == %i (err = %d)", data, qt_prettyDebug(data, qMin(r, ssize_t(16)), r).data(), - maxSize, r); + maxSize, r, err); #endif return qint64(r); |