A file would work, but you'd have to be careful to lock it before each
write, or you could lose updates. It might be better to run a
single-purpose 'counting server' listening on a socket, which
maintained an internal count variable, and incremented and echoed it
across the wire every time a client connected. It's more work than
just setting a global, but no persistence is involved, and you don't
have to worry about race conditions -- just handle the requests on a
first-come, first-served basis.

Lennon