codeslicer
11th July 2010, 02:26
I've been having this issue for a firewall. My application makes a request through QNetworkAccessManager (or QHttp/QFtp) that sometimes cannot be completed. This can happen for several reasons:
Firewall is "freezing" the socket
Server is down or lagging
There is some network problem
My application is aimed to act as a daemon that continuously downloads and uploads data, so when the connection hangs, essentially the application stops performing its tasks. To resolve this problem I need to create a timeout, as there isn't one implemented by default. Here I run into issues though, as there doesn't seem to be a way of aborting a socket for Network Reply. For example this ends up crashing:
QNetworkReply *httpReply;
httpReply = myNetworkAccessManager->get(request)
...
httpReply->abort();
So, anyone have any ideas on how to resolve this?
Thanks in advance.
Firewall is "freezing" the socket
Server is down or lagging
There is some network problem
My application is aimed to act as a daemon that continuously downloads and uploads data, so when the connection hangs, essentially the application stops performing its tasks. To resolve this problem I need to create a timeout, as there isn't one implemented by default. Here I run into issues though, as there doesn't seem to be a way of aborting a socket for Network Reply. For example this ends up crashing:
QNetworkReply *httpReply;
httpReply = myNetworkAccessManager->get(request)
...
httpReply->abort();
So, anyone have any ideas on how to resolve this?
Thanks in advance.