public Zombie() { s = new Server(); DiscoveryServer = new DiscoveryServer(); s.ClientConnected += S_ClientConnected; s.ConnectionDisconnected += S_ConnectionDisconnected; }
static void Main(string[] args) { ConsoleLog log = new ConsoleLog(); DiscoveryServer dserver = new DiscoveryServer(log); IInputController inputController; switch (System.Environment.OSVersion.Platform) { case PlatformID.Win32NT: inputController = new WinInputController(); break; case PlatformID.Unix: inputController = new LinInputController(); break; default: Console.WriteLine("Environment not supported"); return; } InputServer.InputServer iserver = new InputServer.InputServer(log, inputController); Console.WriteLine("Press any key to exit."); Console.ReadKey(); iserver.Dispose(); dserver.Dispose(); }
/// <summary> /// Disables the automatic <see cref="ZyanComponentHost"/> discovery. /// </summary> public void DisableDiscovery() { if (DiscoveryServer != null) { DiscoveryServer.Dispose(); DiscoveryServer = null; } }
public MatchmakerServer(int broadcastPort, BinaryObjectDictionary dictionary) { this.dictionary = dictionary; tcpServer = new TcpServer(); udpReceiver = new UdpReceiver(broadcastPort); discoveryServer = new DiscoveryServer(new UdpBroadcaster(broadcastPort + 1), udpReceiver, tcpServer.AddressArray()); }
/// <summary> /// Enables the automatic <see cref="ZyanComponentHost"/> discovery. /// </summary> /// <param name="port">The port.</param> public void EnableDiscovery(int port) { if (string.IsNullOrEmpty(DiscoverableUrl)) { throw new InvalidOperationException("DiscoverableUrl is not specified and cannot be autodetected for the selected server protocol."); } var discoveryMetadata = new DiscoveryResponse(DiscoverableUrl, DiscoverableVersion); DiscoveryServer = new DiscoveryServer(discoveryMetadata, port); DiscoveryServer.StartListening(); }
public bool Initialize(ILogger logger, ConfigProviderBase configProvider) { this.logger = logger; try { this.discoveryServer = new DiscoveryServer(); } catch (Exception e) { this.logger.Log("Error creating discovery server: " + e); return(false); } this.discoveryServerThread = new Thread(new ThreadStart(() => { try { this.discoveryServer.Run(); } catch (Exception e) { this.logger.Log("Error running discovery server: " + e); } })); try { this.encodingServer = new EncodingServer(); } catch (Exception e) { this.logger.Log("Error creating encoding server: " + e); return(false); } this.encodingServerThread = new Thread(new ThreadStart(() => { try { this.encodingServer.Run(); } catch (Exception e) { this.logger.Log("Error running encoding server: " + e); } })); this.discoveryServerThread.Start(); this.encodingServerThread.Start(); this.logger.Log("Service started..."); return(true); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); // log ILog log = new TextViewLog(this.textview1); // input controller inputController = new LinInputController(); // services dserver = new DiscoveryServer(log); iserver = new InputServer.InputServer(log, inputController); }
public MainForm() { InitializeComponent(); // log foreach (string arg in Environment.GetCommandLineArgs()) { if (arg == "--log") { useLog = true; } } ILog log; miLog.Visible = useLog; if (useLog) { logForm = new LogForm(); log = new TextBoxLog(logForm.TextBox); } else { log = new NullLog(); } // version string lbVersion.Text = GetVersion(); // ip address try { lbIpAddr.Text = GetIpAddress(); } catch { lbIpAddr.Text = "Unknown"; } // input controller inputController = new WinInputController(); // services dserver = new DiscoveryServer(log); iserver = new InputServer.InputServer(log, inputController); // hide window WindowState = FormWindowState.Minimized; ShowInTaskbar = false; }
private static async void RunTask() { var discoveryService = new DiscoveryServer(); discoveryService.NodeConnected += DiscoveryService_NodeConnected; // start server Console.WriteLine("Starting server..."); discoveryService.Start(); Console.WriteLine("Server started!"); Console.WriteLine(); // find server Console.WriteLine("Trying to find server..."); var client = await Client.SearchServer(); Console.WriteLine("Server found! Connected"); Console.WriteLine(); client.Shutdown += ClientMachineShutdown; client.Sync += Client_ExambroUpdateRequested; // shutdown _resetNodeAdded.WaitOne(); var node = discoveryService.Nodes[0]; Console.WriteLine(); Console.WriteLine("Shutdown signal..."); node.SendShutdown(); Console.WriteLine("Signal sent."); // sync Console.WriteLine(); Console.WriteLine("Sync signal..."); node.SendSync(new AppProfile { ChromeHash = "rrrrr", ExamBrowserHash = "yddhgfghfhg", NetFrameworkHash = "dfgdgdgfdgfgd" }); Console.WriteLine("Signal sent."); Console.Read(); _reset.Set(); }
public void Dispose() { if (this.encodingServer != null) { this.encodingServer.Stop(); this.encodingServerThread.Join(); this.encodingServer = null; this.encodingServerThread = null; } if (this.discoveryServer != null) { this.discoveryServer.Close(); this.discoveryServerThread.Join(); this.discoveryServer = null; this.discoveryServerThread = null; } }
public AmongUsDirectorHostedService( DiscordBotService discordBot, AmongUsGame game, GameManagerService gameManager, DiscoveryServer discovery, MothershipCommArray comms, RedisClientService redis) { this.DiscordBot = discordBot; this.Game = game; this.GameManager = gameManager; this.Discovery = discovery; this.Comms = comms; this.Redis = redis; this.Game.GameStarted += this.Game_GameStarted; this.Game.GameEnded += this.Game_GameEnded; this.Game.PlayerJoined += this.Game_PlayerJoined; this.Game.PlayerLeft += this.Game_PlayerLeft; this.Game.PlayerDied += this.Game_PlayerDied; this.Game.MeetingStarted += this.Game_MeetingStarted; this.Game.MeetingEnded += this.Game_MeetingEnded; }
private void InitializeDiscovery() { var discoveryServer = new DiscoveryServer(this); discoveryServer.Start(); }
public void InitProgram(IProgramController controller) { m_controller = controller; m_discovery = new DiscoveryServer(DiscoveryServer.DiscoveryMode.Broadcast); }
public void StartDiscovery() { try { var config = new ApplicationConfiguration() { ApplicationName = "Axiu UA Discovery", ApplicationUri = Utils.Format(@"urn:{0}:AxiuUADiscovery", System.Net.Dns.GetHostName()), ApplicationType = ApplicationType.DiscoveryServer, ServerConfiguration = new ServerConfiguration() { BaseAddresses = { "opc.tcp://*****:*****@"Directory", StorePath = @"%CommonApplicationData%\OPC Foundation\CertificateStores\MachineDefault", SubjectName = Utils.Format(@"CN={0}, DC={1}", "AxiuOpcua", System.Net.Dns.GetHostName()) }, TrustedIssuerCertificates = new CertificateTrustList { StoreType = @"Directory", StorePath = @"%CommonApplicationData%\OPC Foundation\CertificateStores\UA Certificate Authorities" }, TrustedPeerCertificates = new CertificateTrustList { StoreType = @"Directory", StorePath = @"%CommonApplicationData%\OPC Foundation\CertificateStores\UA Applications" }, RejectedCertificateStore = new CertificateTrustList { StoreType = @"Directory", StorePath = @"%CommonApplicationData%\OPC Foundation\CertificateStores\RejectedCertificates" }, AutoAcceptUntrustedCertificates = true, AddAppCertToTrustedStore = true }, TransportConfigurations = new TransportConfigurationCollection(), TransportQuotas = new TransportQuotas { OperationTimeout = 15000 }, ClientConfiguration = new ClientConfiguration { DefaultSessionTimeout = 60000 }, TraceConfiguration = new TraceConfiguration() }; config.Validate(ApplicationType.DiscoveryServer).GetAwaiter().GetResult(); if (config.SecurityConfiguration.AutoAcceptUntrustedCertificates) { config.CertificateValidator.CertificateValidation += (s, e) => { e.Accept = (e.Error.StatusCode == StatusCodes.BadCertificateUntrusted); }; } var application = new ApplicationInstance { ApplicationName = "Axiu UA Discovery", ApplicationType = ApplicationType.DiscoveryServer, ApplicationConfiguration = config }; //application.CheckApplicationInstanceCertificate(false, 2048).GetAwaiter().GetResult(); bool certOk = application.CheckApplicationInstanceCertificate(false, 0).Result; if (!certOk) { Console.WriteLine("证书验证失败!"); } var server = new DiscoveryServer(); // start the server. application.Start(server).Wait(); } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("启动OPC-UA Discovery服务端触发异常:" + ex.Message); Console.ResetColor(); } }