Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.



6122 posts

Uber Geek
+1 received by user: 215

Trusted

Topic # 114549 23-Feb-2013 08:20 Send private message

I've been trawling the net and my understanding is if you are on ios, push ing is done by a server talking to Apple then Apple remotely wakes up the iPhone to download the new stuff. My understanding is the phone is fully asleep at all times hence no battery strain.

It's that right?

It's it the same for android and does setting something to push have no effect on all the times when it is sleeping waiting for the remote poke?

Thanks




Apologies for poor typing standards when on Samsung Galaxy S4 LTE/iPad 2 Wifi

Create new topic
464 posts

Ultimate Geek
+1 received by user: 15


  Reply # 770032 25-Feb-2013 18:15 Send private message

From a low-level network standpoint, there are only a few ways that the push mechanism could be done. I can think of 3 off the top of my head:

(1) A persistent connection from the device to the server. The device makes a request for data and waits for a reply.If the server gets data it'll send it back right away, otherwise it'll eventually send back a "no data"response to keep the network connection alive.


(2) A stateless network connection using UDP. The device blips the server occasionally to say "I'm still here"and to keep any firewall holes alive.May not work with all firewalls.


(3) The device is reachable directly from the public internet. The phone doesn't need to wait for anything - it'll be contacted as needed. Doesn't work with most firewalls.


In the 2 most likely cases, the device needs to keep a network connection alive somehow. I'm not sure whether there is some sort of low power way of doing this without fully waking the CPU, but I'd say that both Android and iOS use fairly similar methods.

5902 posts

Uber Geek
+1 received by user: 74

Trusted
Subscriber

  Reply # 770039 25-Feb-2013 18:33 Send private message

Hi, this is how its done, GCM replaces c2dm but the overall concept is the same.

http://developer.android.com/google/gcm/index.html

Cyril

464 posts

Ultimate Geek
+1 received by user: 15


  Reply # 770258 26-Feb-2013 08:32 Send private message

cyril7: Hi, this is how its done, GCM replaces c2dm but the overall concept is the same.

http://developer.android.com/google/gcm/index.html


Looks like it uses HTTP behind the scenes to transmit the data. HTTP is a request/response protocol, meaning that the server can't arbitrarily push data to the client.All our can do is delay each response as long as possible and probably respond with a 204 No Content if there's nothing to report.


As I mentioned above, this requires that the phone keeps an open network connection. I believe that the CPU can sleep while it's waiting for a response, but it still needs to wake up briefly at regular intervals to keep the connection alive. I'm not sure how long firewalls and routers keep idle TCP connection open for, but it's probably somewhere between 90 seconds and 10 minutes. Chances are that the phone has to wake up every couple of minutes, which does have an effect on battery life.

627 posts

Ultimate Geek
+1 received by user: 18

Subscriber

  Reply # 770268 26-Feb-2013 09:06 Send private message

Why doesn't the phone just sleep completely and then notify the server when/if it has an IP change? That way the server always knows how to contact the phone and send email when it arrives? Hardly any battery use would be the outcome.

5902 posts

Uber Geek
+1 received by user: 74

Trusted
Subscriber

  Reply # 770269 26-Feb-2013 09:20 Send private message

Hi, based on my M2M experience in the past 2min polls will keep both the mobile network and most routed networks open.

Cyril



6122 posts

Uber Geek
+1 received by user: 215

Trusted

  Reply # 770285 26-Feb-2013 09:47 Send private message

myopinion: Why doesn't the phone just sleep completely and then notify the server when/if it has an IP change? That way the server always knows how to contact the phone and send email when it arrives? Hardly any battery use would be the outcome.


is that how apple's push works? if so apple push superior to android push?




Apologies for poor typing standards when on Samsung Galaxy S4 LTE/iPad 2 Wifi

627 posts

Ultimate Geek
+1 received by user: 18

Subscriber

  Reply # 770291 26-Feb-2013 09:49 Send private message

Not sure but that's how I would try and make it :)

464 posts

Ultimate Geek
+1 received by user: 15


  Reply # 772078 1-Mar-2013 08:53 Send private message

Publishing the phone's IP address isn't going to work for most WiFi networks. The vast majority of these networks (including almost every home network) use NAT.

NAT creates a private internal network where each device gets its own private IP address. These addresses are from special reserved ranges that cannot appear on the public internet. When you connect to a public network service your firewall/router forwards the data on your behalf, rewriting the address and port information to make site the data gets to the correct destination.

NAT makes it difficult to receive incoming connections. When a firewall/router receives a connection for port X, it has no way of knowing which device on the internal network to send it to. The only way to get around this is to set up port forwarding, configuring the router to send requests for specific ports to specific internal addresses. This is strictly one port to one address, so if the push server expects to contact the phone on a certain port then only one phone on the network could get push notifications.

The only way around this restriction is to get the phone to register a port number. The server can then try to connect to that port on the IP address that the registration came in on. If everything is set up correctly then out should work.

The question then is how to know what port number to register. There's no standard way to query the router for this information, and you can't expect the user to know it in every case. You could use UPnP to dynamically request a port forwarding be created, but that assumes that UPnP is supported by the router and enabled by the network administrator.

As you can see, the obvious/simple solution is anything but. It might work on cellular networks (if they aren't using NAT) but won't work on the majority of home and business networks. You also wouldn't try to use the IP address/port as a primary method and fall back to polling because then time got 2 loss of code to support. It's far better to support the one method that almost always works, even if it is less efficient.

Create new topic








Twitter »
Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when new jobs are posted to our jobs board:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:




News »

Trending now »
Hot discussions in our forums right now:

Forms of government for New Zealand
Created by charsleysa, last reply by Sidestep on 16-Apr-2014 16:54 (65 replies)
Pages... 3 4 5


why does the tax payer have to pay for the prince and princess' 6 star holiday?
Created by joker97, last reply by Lazarui on 16-Apr-2014 12:56 (66 replies)
Pages... 3 4 5


Business vs Residential UFB, why the huge difference in cost??
Created by dman, last reply by pchs on 16-Apr-2014 16:22 (21 replies)
Pages... 2


Problem with NDSCam
Created by haydenmarsh, last reply by Benoire on 14-Apr-2014 21:28 (21 replies)
Pages... 2


MH370 - Call for Search & Rescue Help
Created by DS248, last reply by Sideface on 15-Apr-2014 16:40 (734 replies)
Pages... 47 48 49


True cost of driving ..
Created by rayonline, last reply by alasta on 14-Apr-2014 20:43 (52 replies)
Pages... 2 3 4


Why is there a lack of ultraportables with Intel Iris graphics?
Created by d3Xt3r, last reply by wasabi2k on 14-Apr-2014 13:21 (32 replies)
Pages... 2 3


Help ! Home business connection and VDSL dead. yikes.
Created by Scotsman, last reply by Scotsman on 16-Apr-2014 17:33 (14 replies)


Geekzone Live »
Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.

Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.