Hacker News .hnnew | past | comments | ask | show | jobs | submitlogin

> On top of that, the cell networks don't allow keeping a socket open for more than a few minutes without sending keepalive packets. Unlike on desktop, keeping a socket open isn't "free" on mobile.

You are wrong. Cell networks don't prevent you from keeping a socket open for however long you want. For how to keep your sockets alive, see https://developer.android.com/reference/android/net/SocketKe...



That method just instructs the OS to send keepalive packets on a system thread.

It saves some CPU power by letting your process sleep, but still requires waking the cell radio up periodically.

The implementation can be found here: https://github.com/aosp-mirror/platform_frameworks_base/blob...


That's right. And it should work as advertised in the documentation. Anyway, I was responding to the "cell networks don't allow" part of your comment. Cell networks don't have a say in what I do at IP/TCP layer.


They literally said that cell networks don't allow it without the keep alive. You quoted it and said they were wrong because... you can use a keep alive. I'm confused as to what you're correcting.


There are collaborations between mobile network providers and push notification providers to get these sockets special-cased. I.e., they won't need keep-alive at any regular interval. So the radio can actually get layer-1 pings (like, when you're called, or get an SMS) for push notifications.


Keepalive across cells are not universally available. Most mobile networks renew your IP at each handover.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: