To check if user connected to UltraVNC server you should enable logging in ultravnc.ini:

DebugMode=2

Then you just need to read log file and check if this file contains string "vnchttpconnect.cpp : HTTP client connected" for http connections and "vncclient.cpp : client connected" for VNC client connections.

C# example that wait for incoming http or vnc connection during localTimeout period:

bool isUserConnected = false;
var startTime = DateTime.Now;
localTimeout = 10000;
do
{
  using (var fileStream = new FileStream("C:\\ultravnc\\WinVNC.log", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
  {
    using (var streamReader = new StreamReader(fileStream))
    {
      string text = streamReader.ReadToEnd();
      isUserConnected = text.Contains("vnchttpconnect.cpp : HTTP client connected") || text.Contains("vncclient.cpp : client connected");
    }
  }
  Thread.Sleep(500);
  DateTime current = DateTime.Now;
  if ((current - startTime).TotalSeconds >= localTimeout)
  {
    isUserConnected = false;
    break;
  }
} 
while (!isUserConnected);