The sleep state is easy to prevent and is pretty well documented in the Power Manager chapter of Inside Mac: Devices under "The Sleep Queue" and "Sleep Procedures", and there is more information in TN 1046: Inside Macintosh: Devices - Power Manager Addenda.
If you wanted to prevent the system from sleeping or dozing, you would:
SleepQRec
(preferably in the system heap).
sleepHandler
.
sleepRequest
or dozeRequest
selector.
In the doze state, OpenTransport networking is still enabled and TCP connections that are set up should still function. But it might take several packets received within a short period (try 10 per second) to wake the machine from its doze state. You might also consider pinging the machine first to get it out of doze.
Either way, you should be aware that it will take some time for the networking to reactivate, especially if virtual memory is enabled and the disk drive must spin up.
There is more information on controlling the Energy Manager in TN 1086: Power Management & The Energy Saver API.Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help