Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.9.3
-
None
-
Windows 7, 64 bit
Description
This issue originates from inside of qnativesocketengine_win.cpp.
A fix from 5.9.2 to 5.9.3 corrected a call to WSAIoctl to obtain the function address of WSARecvMsg inside of QNativeSocketEnginePrivate::createNewSocket, correctly passing the socket value instead of the previous value of socketDescriptor. Previously this would have not returned the pointer and left recvmsg set to null.
The issue arises because the WSARecvMsg functions, at least as to how it is currently (now correctly) being used does NOT fill in the sender address return value, instead leaving it blank. The for-loop that sets cmsgptr = WSA_CMSG_FIRSTHDR(&msg) always sets cmsgptr to null, exiting the loop. (nativeReceiveDatagram)
With the incorrect code from 5.9.2 in place, recgmsg is set to null and this code is never called; instead qt_socket_getPortAndAddress is used which does properly fill in the return address.
The simple solution is to just never use the extended recvmsg/sendmsg functions and instead use the base WsaRecv/WSASend functions (leave the pointers as null or completely remove the code that uses them), which allows the previous functioning code to work.
According to the MSDN does, the extended functions are only minimally supported on Windows 8 and Windows Vista, which may be part of the issue - they apparently do not work on all supported platforms (Windows 7 for example). The extended functions also do not seem to be giving any extra functionality, either by themselves or in the context where they are currently being used - at least none that is not already being provided by existing, more-compatible and functioning code.
Attachments
Issue Links
- duplicates
-
QTBUG-65099 readDatagram() won't return the sender's address in Qt 5.10.0
-
- Closed
-