private void MainForm_Load(object sender, EventArgs e) { LogHelper.Initialize(@"D:\ServerApp_Data", 30); _mmfServer = new MMFServer(); _mmfServer.ErrorRaised += _mmfServer_ErrorRaised; _mutex = new Mutex(false, MMFDefine.MUTEX_NAME); }
static void Main(string[] args) { // var svr = new ServerHandleImpl(DEFAULT_PORT); // svr.Start(); // svr.Shutdown().Wait(); // return; if (args.Length < 1) { Console.WriteLine(FALLBACK_HELP); return; } string command = args[0]; if (command == "rpc") { int port; if (args.Length > 1) { if (!int.TryParse(args[1], out port)) { throw new ArgumentException($"Cannot parse port number from given argument {args[1]}." + '\n' + FALLBACK_HELP); } } else { port = DEFAULT_PORT; } var server = new ServerHandleImpl(port); server.Start(); server.Shutdown().Wait(); } else if (command == "mmf") { if (args.Length > 1) { Console.WriteLine("run mmf"); MMFServer.Run(args[1]); } else { Console.WriteLine("run mmf"); MMFServer.Run(); } } else { Console.WriteLine(FALLBACK_HELP); return; } }