static void Main(string[] args) { EventServer s = new EventServer(); s.Start(); Console.ReadKey(); }
static void Main(string[] args) { if (args.Length == 0) { Console.WriteLine("Do not execute this application!"); return; } EventRegistry.BuildDictionary(); SynchronizationContext.SetSynchronizationContext(new SynchronizationContext()); _eventServer = new EventServer(Int32.Parse(args[0])); _eventServer.OnEventReceived += EventReceivedHandler; _eventServer.Start(); CefSettings settings = new CefSettings(); CefSharpSettings.ShutdownOnExit = true; settings.CefCommandLineArgs.Remove("mute-audio"); Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null); while (true) { Thread.Sleep(1); } }
public static void InitEventServer() { var eventServer = new EventServer(GetIpAddress()); eventServer.Start(); var eventClient1 = new EventClient(GetIpAddress()); eventClient1.AddToGroup("Task", "Random"); eventClient1.Connect(); eventClient1.PublishEvent += (s, a) => { Console.WriteLine("CLIENT1: " + a.Arguments.ToString()); }; var eventClient2 = new EventClient(GetIpAddress()); eventClient2.Connect(); eventClient2.AddToGroup("Task"); eventClient2.PublishEvent += (s, a) => { Console.WriteLine("CLIENT2: " + a.Arguments.ToString()); }; var eventClient3 = new EventClient(GetIpAddress()); eventClient3.Connect(); eventClient3.AddToGroup("Task", "Random"); eventClient3.PublishEvent += (s, a) => { Console.WriteLine("CLIENT3: " + a.Arguments.ToString()); }; while (true) { eventClient1.SendEventToAll(new CustomEventData() { FirstName = "Event to All", LastName = "B" }); eventClient1.SendEventToOthers(new CustomEventData() { FirstName = "Event To Others", LastName = "D" }); eventClient1.SendEventToAllInGroup(new CustomEventData() { FirstName = "Event to all in Group Task", LastName = "D" }, "Task"); eventClient1.SendEventToRandomInGroup(new CustomEventData() { FirstName = "Event to random in Group Random", LastName = "D" }, "Random"); Console.WriteLine("Message sent"); Console.ReadLine(); } }
protected internal virtual void Start() { if (scpd_server == null) { throw new InvalidOperationException("The service controller has not been initialized."); } scpd_server.Start(); control_server.Start(); event_server.Start(); }
static void Main(string[] args) { Console.WriteLine($"테스트 전송할 파일 경로 : {PATH}"); Debug.MessageWritten += Debug_MessageWritten; //DatabaseManager.Initialize(); mServer = new EventServer(31006); mServer.ClientConnected += Server_ClientConnected; mServer.Start(); Console.WriteLine("서버가 시작되었습니다. 31006 포트"); Console.WriteLine("아무키나 누르면 클라이언트를 종료합니다..."); Console.ReadKey(false); mServer.Halt(); }
private void OpenServer(object o) { try { Server = new EventServer(31006); Server.Start(); this.Dispatcher.Invoke(() => { SetState(true); Clients.BindCollection(); }); } catch (Exception e) { this.Dispatcher.Invoke(() => { SetState(false); MessageBox.Show(this, "서버를 시작할 수 없습니다. 인터넷 연결상태를 확인해주세요.\n\n자세한 오류 메세지 : " + e.Message, "오류", MessageBoxButton.OK, MessageBoxImage.Error); }); } }