Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QNetworkInterface::allInterfaces() produces error messages



  • Hi all -

    This has been going on for awhile, but given that I'm having some other networking issues, I figured it was time to solve this.

    void UdpSocket::sendDiscoveryMsgs()
    {
        QList<QNetworkInterface> qnil;
    
        qnil = QNetworkInterface::allInterfaces();
    ...
    

    Produces this output in the console window:

    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    

    Don't know what more I can really say about it...anyone have any ideas?


  • Lifetime Qt Champion

    Hi,

    What version of Qt are you using ?
    On what OS ?


  • Qt Champions 2019

    This post is deleted!


  • @sgaist Oh, sorry...Windows 10, and 5.12.3.

    This is part of an earlier exercise that was made necessary because Windoze doesn't let you specify which network interface you want to use, so my Qt app was always finding its way to the wrong interface, and couldn't talk to my target device.

    I get a list of interfaces, and send a message to each one. The one that answers, I presume to be the "correct" interface, and I go from there. Simple in concept, but it's proving to be rather complicated, and not so reliable.

    EDIT:

    A little more information: I upgraded to 5.13.1 (and Creator 4.10) with the same results. BUT: I also noticed it only does it when running in the debugger. Even my debug build, when launched without the debugger, does not produce the above output.

    So...possibly an error in Creator?



  • @mzimmers
    May I ask/suggest something, meaning it to be helpful?

    For this kind of problem and question you have, do you compile Qt yourself and have the sources? If I were developing in C++, I'd hope to run the program from the debugger with all the Qt source and C++ runtime source there. Then you might get stack traces and debug info, be able to break and step, etc. Once set up, I would have thought that might help with all sorts of nasties, or needing to understand?



  • @jonb I could do that. It'll take some time to set up and build, though. Now that I've discovered this problem only manifests when the debugger is running, I'm not as concerned about it, though I wonder whether I should report it as a bug.



  • @mzimmers
    What I had in mind is there are other deep questions you sometimes have. It's worth it if you can easily re-use the environment all the time, I didn't mean for once-off.

    And, yes, there are occasions where a problem only manifests in the debugger, or not in the debugger, or only when do/don't compile for debug, and that can get infuriating!


Log in to reply