auto-detection of client/server state