예제 #1
0
파일: vrpn_Oculus.C 프로젝트: ASPePeX/vrpn
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();
}
예제 #2
0
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);
	}