private static void Main(string[] args) { var s = new VncServer("", "a", 5901, 5900, "Ulterius VNC"); try { s.Start(); Console.Read(); s.Stop(); } catch (ArgumentNullException ex) { s.Stop(); return; } }
private static void Main(string[] args) { var s = new VncServer("", "password", 5901, 5900, "VNC Client"); Thread thr = new Thread(new ThreadStart(startTunnel)); try { thr.Start(); s.Start(); Console.Read(); s.Stop(); } catch (ArgumentNullException ex) { s.Stop(); return; } }
public static void Cleanup() { try { if (EDDNComm != null) { EDDNComm.Dispose(); EDDNComm = null; } if (JournalScanner != null) { JournalScanner.Dispose(); JournalScanner = null; } if (DBCon != null) { DBCon.Dispose(); DBCon = null; } // if EliteDBProcess is not null the process is created // by this program, so we also have to do the cleanup if ((EliteDBProcess != null) && (!EliteDBProcess.WasRunning)) { String user = IniFile.GetValue("DB_Connection", "User", "RN_User"); String pass = IniFile.GetValue("DB_Connection", "Pass", "Elite"); EliteDBProcess.StopServer(user, pass); EliteDBProcess.Dispose(); EliteDBProcess = null; } Data.Dispose(); #if useVNC if (VNCAppServer != null) { VNCAppServer.Stop(); } #endif //VNCServerThread = new System.Threading.Thread(new System.Threading.ThreadStart(s.Start)); } catch (Exception ex) { throw new Exception("Error while cleaning up", ex); } }
public void StopVncServer() { if (vncThread != null) { vncServer.Stop(); vncWindow.Close(); // It's important to null these things so the garbage collector // will free the dangling resources (sockets, threads, etc). // The nulls also trigger Start() to recreate the now-defunct objects vncWindow = null; vncThread = null; vncServer = null; GC.Collect(); GC.WaitForPendingFinalizers(); } }
public void StartVncServer() { try { var settings = new Settings(); var vncProxyPort = settings.Read("Vnc", "VncProxyPort", 5901); var vncPort = settings.Read("Vnc", "VncPort", 5900); var vncPass = settings.Read("Vnc", "VncPass", ""); vncServer = new VncServer(vncPass, vncProxyPort, vncPort, "Ulterius VNC"); Task.Run(() => { vncServer.Start(); }); var endData = new { vncStarted = true, proxyPort = vncProxyPort, port = vncPort, message = "VNC Server Started" }; serializator.Serialize(_client, packet.endpoint, packet.syncKey, endData); } catch (ArgumentNullException) { vncServer?.Stop(); } }