void vrpn_Oculus::mainloop() { vrpn_gettimeofday(&d_timestamp, NULL); // See if it has been long enough to send another keep-alive if (vrpn_TimevalDurationSeconds(d_timestamp, d_lastKeepAlive) >= d_keepAliveSeconds) { writeKeepAlive(); d_lastKeepAlive = d_timestamp; } update(); server_mainloop(); }
void KitSocket::_worker(void) { int bytes; sflap_frame frame; // send the server a keepalive every 15 minutes if(++keepalivecount >= (15 * 60 * 1000 / KITSOCKET_WORKER_PERIOD)) { keepalivecount = 0; if(keepAlive) writeKeepAlive(); } // check for stuff to read from the server bytes = ::read(sock(), (void *)&frame, 6); if(bytes < 0) { ERRNO_SWITCH(break, print_frame("KitSocket::_worker() -- reading -- bytes < 0", frame); disconnectSocket(); return); }