Is there any way to detect if the XMPP server is alive?

Is there a defined keep-alive packet in TIMP, e.g., client just send a pre-defined packet and expects the Server to echo/send some packet back to show that it is still alive?

This is for the client to detect abnormal breaking of connection.

To check if the connection is still alive you can send just a space character every 30 seconds (for example). If the socket goes in an error state it means you have been disconnected. You should also tune socket options like KEEP ALIVE.

You can also send a jabber browse request (for example) from time to time, but this is discouraged since it causes server overload.