Online / Offline state detection