private static void Main(string[] args) { var s = new VncServer("password", 5901, 5900, "Ulterius VNC"); try { s.Start(); } catch (ArgumentNullException ex) { s.Stop(); return; } }
static void Main(string[] args) { VncServer s = new VncServer("T!T@N", 5900, "T!T@N-VNC"); try { s.Start(); } catch (ArgumentNullException ex) { Console.WriteLine(ex.Message); return; } Console.ReadLine(); }
static void Main(string[] args) { VncServer s = new VncServer("", 5900, "VNC", 640, 480); //s.ConnectAction(ac); s.ConnectActionRaw(ac2); s.ConnectInputs(keyev, mouseev); try { s.Start(); } catch (ArgumentNullException ex) { Console.WriteLine(ex.Message); return; } Console.ReadLine(); }
/// <summary> /// The main server loop. Listening on the selected port occurs here, and accepting incoming connections /// </summary> public void Start(VncServer server) { this.Server = server; isRunning = true; try { serverSocket = new TcpListener(IPAddress.Any, Port); serverSocket.Server.NoDelay = true; serverSocket.Start(); } //The port is being used, and serverSocket cannot start catch (Exception ex) { Console.WriteLine(ex.ToString()); //Close(); return; } try { //SocketError error = SocketError.AccessDenied; localClient = serverSocket.AcceptSocket(); localClient.NoDelay = true; //Disable the Naggle algorithm IPAddress localIP = IPAddress.Parse(((IPEndPoint)localClient.RemoteEndPoint).Address.ToString()); Console.WriteLine(localIP); stream = new NetworkStream(localClient, true); reader = new BigEndianBinaryReader(stream); writer = new BigEndianBinaryWriter(stream); zlibWriter = new ZlibCompressedWriter(stream); clients.Add(localClient); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
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(); } }
internal static void StartVNCServer(Form form1) { try { #if useVNC if(Program.DBCon.getIniValue<Boolean>("Settings", "ActivateVNC", false.ToString(), false)) { VNCAppServer = new NVNC.VncServer("", "", 5901, 5900, "ED-IBE Remote", form1); VNCServerThread = new System.Threading.Thread(new System.Threading.ThreadStart(VNCAppServer.Start)); VNCServerThread.Start(); } #endif } catch (Exception ex) { Program.DBCon.setIniValue("Settings", "ActivateVNC", false.ToString()); throw new Exception("Error while starting VNC server", ex); } }