No network connection

  • Hi,

    I'm developing an application which needs a connection to the internet.
    To make a request, I use in javascript XMLHttpRequest.
    Everything goes fine most of the time, but sometimes I can't make a connection.
    I didn't manage to recognize a pattern when it can connect and when not.

    When I have my app running on my phone and make a request, I don't get a reply.
    The request doesn't even make it to my server, so that already explains why I don't get a reply.
    After a while, in my Application Output appears:
    [Qt Message] <Unknown File>:1: SyntaxError: Parse error

    I was able to load a webpage in the browser, so the phone has a working internet connection.
    Also the application can connect to the internet most of the time, only very sometimes it can't, so I assume it can't be a problem with the capabilities in the .pro file.

    Anybody has an idea about this problem why it happens, or how I can solve this?
    Thanks in advance

    Edit: I already figured out that after a long time, I do get a reply.
    But the reply is empty, which causes the error I get.
    Also, I can't find anything back in the logs of my server, so the request didn't reach the server.
    On some moments the connection works, on other moments it doesn't. So I still didn't find any solution :(

  • Moderators

    Do you have the necessary capabilities (assuming you are on Symbian phone) set for your application?

  • why not integrate you project with C++ and using QTcpSocket? it's more stable than Http :)

  • Tobias: Yes, I'm on a symbian phone, and most of the times the network connection is working, so I assume it's not a problem with the capabilities.

    mohsen: I'll look up some information about it. But do you think it can solve the problem?
    edit: I've looked up some info about it, but I don't think that it can help me. The server I'm connecting to is an http server, so it would be easier to use QNetworkAccessManager then. But I already use that in some places, and there I also don't get a reply. So I think the problem must be somewhere else.

  • Tobias meant your application capabilities, not phone capabilities. Or you have network working in other parts of your app and it doesn't working only in this small part?

  • I was also talking about phone capabilities ;-) I have added NetworkServices in the .pro file.
    Well most of the time the application is working, everything. But very sometimes there's no network connection, in the whole application. But when I open the web browser, I can browse on internet, so it can't be that the phone doesn't have network access.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.