0

I've made an client app for OSX and now I have some troubles with OSX energy saving settings. So, in short, my problem is that when system goes to sleep mode, the network connection turns off.

It's mentioned in Apple support here

What happens when the Mac goes to sleep (not just into idle mode or display sleep)?

The Ethernet port turns off, if applicable (see note below)

Note: Portable computers have no network connectivity when in sleep mode, but can wake if the Energy Saver option "Wake for network access" is enabled. If you wish to use file sharing or don't want to interrupt your Internet connection, you should not manually put the computer to sleep, and you should drag the "Computer sleep" slider to Never.

So my client app cannot reach the service because of that. Regrettably, it is very unlikely, that I can just force end-users to turn off the "computer sleep" option.

I've tested my app working with "computer sleep" option turned on and off on long distances and it's quite obvious, that when this option is off, everything works fine, when it's on, requests stop working when system goes to sleep (with display sleep it works ok). The "Wake for network access" checkbox is also checked, but doesn't seem to help.

My question is, how can I allow my app to use network, when this option is turned on? There is a "Power Nap" option in energy settings, can I make my app support it somehow? If not, is there any programmatic solution, that would not require any action from end-user side?

Also, if this is impossible to implement, can I have an explanation why? Current apple documentation doesn't explain much about networking during sleep.

P.S. There's a similar question here on stackoverflow, that answers this question: How to programmatically prevent a Mac from going to sleep?

Looks like, I somehow missed it.

Community
  • 1
  • 1
Olter
  • 1,129
  • 1
  • 21
  • 40
  • 2
    Could you clarify the question? It sounds as if you are talking about the **client** computer going to sleep. But if the client computer is asleep then the client app isn't running. It therefore doesn't need network access, and there is no problem. Are you trying to run the **server** on a laptop? Or is the client meant to **listen** for data from the server? Or is your problem that the client can't connect to the network *after the laptop has woken up again*? – nugae Aug 03 '16 at 07:00
  • @nugae, I have a client app on Mac, written on objective c (client is written by me). It works with the remote service (service is not written by me). When the client computer goes to sleep I need my app continue working with service. The idea is, that user can leave his machine for a several hours (imagine, that he went to lunch or left computer turned on for night) and app is still working during this time. I hope, I've explained it well. – Olter Aug 03 '16 at 07:10
  • 2
    When the computer is asleep it is asleep and your app won't be running at all. – nugae Aug 03 '16 at 07:23
  • I honestly don't think, you're right here. I have a local log file for the app and I can see, that when computer is asleep, app still continues to write data to this log file, for example. That doesn't look like "app not running at all" to me. The messages about requests failed are also written down in this log, which means that app at least trying to send them to service. – Olter Aug 03 '16 at 07:30

0 Answers0