×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    28

    HTTP Connection behaviour when 3G connection is lost (or being lost)

    Hello,
    My application works fine in the normal case of a good 3G/GPRS signal.
    I'm basically sending a HTTP message every minute to update a status on a server using a GET request.

    The problem is when I'm entering an area of no GPRS/3G signal, I get very strange behaviour.
    On vodafone UK with 3G SIM.

    If I lose the signal for a minute or less, then:
    1. The thread making the HTTP get request is blocked
    2. On getting the signal back, the HTTP request completes ok

    If I lose the signal for more than a minute or so then
    1. The thread making the HTTP get request is blocked
    2. The GET request never completes, leaving a zombie thread (until I quit my application)

    Finally, I added the code to NOT send a HTTP GET if the network is unavailable using
    String available = System.getProperty("com.nokia.mid.networkavailability");

    In this case it gets even weirder.
    1. When the network is not available. I store up the GET request in a queue.
    2. When the network is available, the first GET returns with HTTP error 403, and all subsequent gets return HTTP error 403.

    I can confirm that the GET request which generate the 403 are exactly the same as what would usually be sent when the signal is ok.

    As far as I can see, my webserver isn't generating the HTTP 403 - it's not getting that far. So could it be MIDP or vodafone giving me 403.

    I can reproduce the problem reliably simply by taking a tube journey on the london underground.

    My questions
    1. What is the expected behaviour of the HTTP class (the fact that it never completes or times out must be a bug)
    2. Does anyone know of what might cause a HTTP 403?

    Any help would be appreciated. I fear that the networking code on midp/s60 really not up to commercial product quality.

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: HTTP Connection behaviour when 3G connection is lost (or being lost)

    Depends what you mean by "commercial product quality". Sadly, Java runtimes on most phones are atrociously bug-ridden. Nokia are far from the worst offenders.

    My experience is generally one of connections timing-out, but I have seen several people report connections that never time out on some newer Series 60s. What phone are you using?

    I've never seen this 403 issue. If you're sure it's not coming from your own server, then I'd guess it's from Vodafone. Are you using a contract or PAYG SIM? PAYG SIMs may result in you getting some kind of "access denied" response from non-white-listed servers. (PAYG SIMs are available to under 18s, and Vodafone's tend to come with access restrictions by default, I think to stop children from accessing inappropriate content.) So, the 403 might be coming from Vodafone.

    Network access on any mobile is variable, subject to a number of factors:

    * The device.

    * The device's configuration (access points, and so on, whether you're using HTTP over WAP or over TCP).

    * The network.

    * Where you are (for example, in one part of Cheshire, I have been unable to download JARs larger than 300k on Vodafone... while at the same time, my colleagues in Scotland were able to download fine (same network)).

    As my opinion, I would say that a request every minute is quite a lot. Network access on mobiles is obviously more complex than using a wired network on a pc, and in general the hardware and software of a phone is less sophisticated. Connection problems are common, and the device's resiliance to connection problems is sometimes less than 100%. In particular, as I said earlier, I get the impression that some Series 60s do have an issue (under some circumstance that I don't know) of simply blocking perpetually on a failed connection.

    With any connected application, I recommend testing on as many devices as possible, on as many networks as possible. At the very least, this will help you determine the scale of the problem, for example:

    * Your application doesn't work.

    * Your application doesn't work on Nokia Series 60s.

    * Your application doesn't work on some Nokia Series 60s.

    * Your application doesn't work on some Nokia Series 60s on Vodafone.

    Or some other combination.

    I appreciate that this is not a definitive answer, but I hope it helps.

    Cheers,
    Graham.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    28

    Re: HTTP Connection behaviour when 3G connection is lost (or being lost)

    Quote Originally Posted by grahamhughes View Post
    Depends what you mean by "commercial product quality". Sadly, Java runtimes on most phones are atrociously bug-ridden. Nokia are far from the worst offenders.

    My experience is generally one of connections timing-out, but I have seen several people report connections that never time out on some newer Series 60s. What phone are you using?

    I've never seen this 403 issue. If you're sure it's not coming from your own server, then I'd guess it's from Vodafone. Are you using a contract or PAYG SIM? PAYG SIMs may result in you getting some kind of "access denied" response from non-white-listed servers. (PAYG SIMs are available to under 18s, and Vodafone's tend to come with access restrictions by default, I think to stop children from accessing inappropriate content.) So, the 403 might be coming from Vodafone.

    Network access on any mobile is variable, subject to a number of factors:

    * The device.

    * The device's configuration (access points, and so on, whether you're using HTTP over WAP or over TCP).

    * The network.

    * Where you are (for example, in one part of Cheshire, I have been unable to download JARs larger than 300k on Vodafone... while at the same time, my colleagues in Scotland were able to download fine (same network)).

    As my opinion, I would say that a request every minute is quite a lot. Network access on mobiles is obviously more complex than using a wired network on a pc, and in general the hardware and software of a phone is less sophisticated. Connection problems are common, and the device's resiliance to connection problems is sometimes less than 100%. In particular, as I said earlier, I get the impression that some Series 60s do have an issue (under some circumstance that I don't know) of simply blocking perpetually on a failed connection.

    With any connected application, I recommend testing on as many devices as possible, on as many networks as possible. At the very least, this will help you determine the scale of the problem, for example:

    * Your application doesn't work.

    * Your application doesn't work on Nokia Series 60s.

    * Your application doesn't work on some Nokia Series 60s.

    * Your application doesn't work on some Nokia Series 60s on Vodafone.

    Or some other combination.

    I appreciate that this is not a definitive answer, but I hope it helps.

    Cheers,
    Graham.
    Thanks for taking time to answer Graham. I appreciate it.
    I've tried on two separate E71s and an N95 (both on voda contract). I will try later on on orange.

    By commercial product quality, I mean one that I can deploy to a customers and fix bugs in response to their problem reports.
    In this case, i'm developing a GPS application where we send an update over HTTP every 5 mins or so (or 1 min when the device is plugged into the car charger). Diminished battery life is something we explain to our customers- but most of the time will be spent in the car charger.

    The problem is not so much that networks are erratic but that HTTP request doesn't have a defined time-out or an asynchronous cancel feature.
    If I could just cancel the request on a time out and retry later I could work around it but it seems impossible.
    If I was writing this in C++ I could cancel any request. And it's looking more likely that C++ version is on the cards.

    I was thinking that writing my own HTTP over socket:// was an option, but there seems to be a limit of 200 request on S60.
    However, the code is here anyway:
    http://myhowto.org/java/j2me/20-usin...-applications/

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: HTTP Connection behaviour when 3G connection is lost (or being lost)

    In my experience, Orange has been the friendliest network for connected apps.

    I understand. The HTTP connections should time-out. Even then, it's not a wonderful system. Time-out can take a few minutes, you can't abort a connection, and you may be limited in the number of simultaneous connections you can attempt (with each of those "timing-out" connections taking up a slot).

    Out of interest, have you tested this in a native app? It's quite possible that the socket bug is not in the Java runtime, but further down.

    Yes, I've done the HTTP-over-socket thing myself, some years ago. Unfortunately, on JSR-185 compliant devices, you need to sign the app with a trusted signature in order to open a SocketConnection on ports 80 or 8080.

    I'd be interested to know anything else you discover.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    28

    Re: HTTP Connection behaviour when 3G connection is lost (or being lost)

    Quote Originally Posted by grahamhughes View Post
    In my experience, Orange has been the friendliest network for connected apps.

    I understand. The HTTP connections should time-out. Even then, it's not a wonderful system. Time-out can take a few minutes, you can't abort a connection, and you may be limited in the number of simultaneous connections you can attempt (with each of those "timing-out" connections taking up a slot).

    Out of interest, have you tested this in a native app? It's quite possible that the socket bug is not in the Java runtime, but further down.

    Yes, I've done the HTTP-over-socket thing myself, some years ago. Unfortunately, on JSR-185 compliant devices, you need to sign the app with a trusted signature in order to open a SocketConnection on ports 80 or 8080.

    I'd be interested to know anything else you discover.
    Ok, after a bit of a delay. I have an update on this.
    See other post
    http://discussion.forum.nokia.com/fo...d.php?p=585183

    The vodafone HTTP403 issue appears to be related to the A-GPS access point.
    I think I found a bug in the AGPS service. When I switch SIMs on my phone - A-GPS grabs the "Vodafone live!" access point (when it should be using GPRS access point).
    Something isn't releasing the PDP context correctly, and my exitsting (unrelated) connection seems to get a HTTP 403 until I close the context and re-open.
    Of course, A-GPS starts to kick into action just at the point where you are getting a signal (both GPS and packet data) - so that would explain why it occurs during signal loss.

    Getting end users to change the A-GPS setting to GPRS seems to avoid the problem.
    We have now had so many problems with Java ME, that we are forced to go Native.
    Last edited by TwmD; 2009-05-27 at 15:00. Reason: add a URL

  6. #6
    Registered User
    Join Date
    Jan 2010
    Posts
    1

    Re: HTTP Connection behaviour when 3G connection is lost (or being lost)

    Hi

    I get an HTTP 403 error all the time when browsing on my E72 with Vodafone.

    The only way I can clear this is by turning the phone off and back on again - is there a better method to reset this problem?

    Thanks

    Rob

  7. #7
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: HTTP Connection behaviour when 3G connection is lost (or being lost)

    Hi Rob,

    You've found the support forum for software developers, but it sounds like you want end-user support. Nokia support can be found here. Alternatively, contact your network operator.

    Graham.

Similar Threads

  1. How to create Http Connection by specifying the client port?
    By SYTDeath in forum Mobile Java Networking & Messaging & Security
    Replies: 6
    Last Post: 2008-01-09, 19:35
  2. How to cancel a http connection mid-way
    By capricious28 in forum Mobile Java General
    Replies: 0
    Last Post: 2007-08-10, 10:42
  3. remote host address(of socket and http connection as well)
    By p_joon in forum Mobile Java General
    Replies: 1
    Last Post: 2007-03-05, 08:04
  4. Problem in Http Connection
    By jaceline in forum Mobile Java General
    Replies: 0
    Last Post: 2005-10-14, 04:08
  5. HTTP Connection issue
    By akhilss in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2005-09-12, 19:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×