Important: Please read the Qt Code of Conduct -

Problem transfering bigger data amounts over Websockets on iOS

  • Hi,

    I currently have a problem with websockets on iOS. I'm using a websocket connection to send commands and files over a network (WiFi) between 2 devices. The server is a Windows CE device with Qt5.3 and the client can be an iPad or Windows PC, using a program compiled with Qt 5.7.1. The files are transfered by breaking them into smaller parts (~20-300KB, depending on the speed of the last part) and sending them as a websocket message. There is a small protocol implemented to coordinate the parts.

    Especially when transfering bigger files(>200MB) over the network, at some point i always run into a disconnect of the socket with the closeReason "Timeout when reading data from socket." on the Client. The server then gives a normal disconnect without closeReason.

    My first question is: Is this a normal closeReason for a disconnect in case of a bad WiFi connection or could it be a bug in my software or even in Qt's Websocket implementation? I did force some disconnects by powering off the server device while transfering data, and I did not get the same error on the client.

    I also found the QTBUG-14975 which very much sounds like my issue. The closeReason is set in qwebsocketframe.cpp after a waitForReadyRead(5000). But the main differences are that this bug is only reported as happening on Windows and about every 4-5GB transmitted. In my case it's happening only on iOS and about every 200-300 MB.

    Since the problem only happens on iOS(iPad and simulator) but not with a Windows PC as client, i am also thinking about, if this could be an OS related problem. Like iOS detecting a Wifi disconnect earlier when a Windows PC maybe waits a bit longer and the connections get better again.

    Would it be a solution to change the timeout of the waitForReadyRead(5000) in qwebsocketframe.cpp and compile a custom Qt? Is it likely that this will help?

    Thanks for any help on that topic. I'm investigating this problem for days and don't find any solution.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    That's something I'd recommend bringing to the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.

Log in to reply