there's an API that I found that's supposed to make this determination but
it never seems to change even if you poll afterward. I've heard the same
from a few other people so AFAIK, the above is probably the most reliable
way I can think of. Of course you could also implement a ping or similar
mechanism but each has some potential shortcomings and this is as robust as
antyhign else.