If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

How to get Restart,Shutdown .... events

Hi Guys,
My first query is what are different automation testing tools are available in Mac?

Second is:

I have written a network application in cocoa.
In my application I want to capture the Logout,Restart,Shutdown events.
Based on these events I want to send some message to my server.

After reading the documentation on internet regarding system events I came to know that whenever user choose "Shutdown" or "Restart" from the Apple Menu the running application gets "KAEQuitApplication" event but not any specific event whether the application is quiting by "Shutdown" or "Restart" or "Log Out". The "KAEQuitApplication" event also get by the user when he/she quit their application by clicking at the top left cross button of the application window.

I m looking to get the specific event related with each action taken by the user i.e. "Shutdown" or "Restart" or "Log Out".
Is it possible to get the different event for each of the action taken by the user i.e. "Shutdown" or "Restart" or "Log Out"?.

I do not think that there is a privacy issue here, other than from a security angle.

If a user Logs Out, then the session should be closed and any cookies erased. It is a conscious request that must be responded to accordingly.

Restart or Shutdown are the same.......... and identical to system crashes, power outs. The user merely terminates the connection. This may be willing or unwilling, you have no way of telling as that is "client side".

You now have just two possible scenarios:

1. The user requests closure
2. The contact is terminated for "some reason"

In the first instance the response is simple. In the second scenario the response will depend upon user requirements. I would suspect that something like a session validation check every "x" minutes, then close the session if there is no response from the client.

The simplest and safest approach is to close the session on loss of contact. All you need to log is if it was requested or just happened. That way you minimise the risk of session hijacking.

From the client side you should be able to determine the "abrupt" terminations, but not an orderly shutdown request, as this is not an "event", it is someone using an application within its normal parameters.

You should be able to detect a requested shutdown

1. Shut Down Machine or Restart ( no significant difference as shutdown happens in both cases)
2. User Logout/Change (should close open applications)
3. Close Application

You then assume that anything that does not do that is a systems crash of some sort, or a power down. You have no choice there, as neither the application nor the OS will have the opportunity to report the plug being pulled.

Items #1 ~ #3 above would be kicked off by "system" at the request of "user"........... assuming that "user" has the proper authorities.