private void 启动WEB网关ToolStripMenuItem_Click(object sender, EventArgs e) { httpServer = new MyHttpServer(Convert.ToInt32(toolStripTextBox1.Text)); httpServer.EventMylog += HttpServer_EventMylog; httpServer.Start(Convert.ToInt32(toolStripTextBox1.Text)); textBox1.Text = toolStripTextBox1.Text + "端口已启动,可以接收HTTP请求"; }
private void init() { _dispatcher = new RoomEventDispatcher(); _roomFactory = new ServerRoomFactory(_dispatcher, _coRoutineManager, _assetManager); _roomManager = new SingleRoomManager(_roomFactory, _dispatcher, false, _roomListener); _loginServer = new LoginServer(_dispatcher, _roomManager); _loginServer.Start(new NetworkPortInfo( SingletonManager.Get <ServerFileSystemConfigManager>().BootConfig.BattleServer.TcpPort, SingletonManager.Get <ServerFileSystemConfigManager>().BootConfig.BattleServer.UdpPort)); _hallServerNetwork = new HallServerNetwork(_dispatcher); _hallServerNetwork.StartServer(new NetworkPortInfo( SingletonManager.Get <ServerFileSystemConfigManager>().BootConfig.HallRoomServer.ListenPort, 0)); MyHttpServer.Start(SingletonManager.Get <ServerFileSystemConfigManager>().BootConfig.HttpPort); if (SingletonManager.Get <ServerFileSystemConfigManager>().BootConfig.AllocationServer.Open == 1) { _hallServerNetwork.ClientConnect(new NetworkPortInfo( SingletonManager.Get <ServerFileSystemConfigManager>().BootConfig.AllocationServer.ConnectPort, 0)); } else { _logger.InfoFormat("Server Configuration: Do Not connect to Allocation Server!"); } }
public void StartListening(string app = "", int port = 80) { httpserver = new MyHttpServer(app, port); httpserver.HandleRequest += Httpserver_HandleRequest; httpserver.Start(); }
public bool Start(int port = 0) { try { Api.Init(Program.Config.Path, Program.Config.ScriptFolder, Program.Config.CardCDB); BanlistManager.Init(Program.Config.BanlistFile); //DecksManager.Init(); MsgSystem.Init(Program.Config.File_ServerMsgs); WinInfo.Init(Program.Config.WinDbName); if (File.Exists(Program.Config.File_BanAccont)) { string[] lines = File.ReadAllLines(Program.Config.File_BanAccont); foreach (string line in lines) { if (string.IsNullOrEmpty(line) || line.StartsWith("#")) { continue; } string name = line.Trim(); if (!banNames.Contains(name)) { banNames.Add(name); } } } try{ Directory.CreateDirectory(Program.Config.replayFolder); }catch (IOException) { } IsListening = true; m_listener = new TcpListener(IPAddress.Any, port == 0 ? Program.Config.ServerPort : port); m_listener.Start(); Thread acceptThread = new Thread(new ThreadStart(AcceptClient)); acceptThread.IsBackground = true; acceptThread.Start(); WinSaveTimer.Start(); ApiServer.Start(); } catch (SocketException) { Logger.WriteError("The " + (port == 0 ? Program.Config.ServerPort : port) + " port is currently in use."); return(false); } catch (Exception e) { Logger.WriteError(e); return(false); } Logger.WriteLine("Listening on port " + (port == 0 ? Program.Config.ServerPort : port)); if (BanlistManager.Banlists != null && BanlistManager.Banlists.Count > 0) { Logger.WriteLine("Banlist = " + BanlistManager.Banlists[0].Name); } return(true); }
private void btnStart_Click(object sender, System.EventArgs e) { if (_server.IsRunning) { Stop(); } else { _server.Start(); btnStart.Text = "Stop"; this.BackColor = _runningColor; } }
public ChatRecordChromeV2(ChatDesk desk) { try { _latestRecieveMsgTime = DateTime.MinValue; _unloadTime = DateTime.MinValue; _preIsConnected = false; _preTryConnectTime = DateTime.MinValue; _preOpenChromeDevTime = DateTime.Now; _desk = desk; _httpSvr = MyHttpServer.HttpSvrInst; _httpSvr.Start(); _httpSvr.OnRecieveMessage += httpSvr_OnRecieveMessage; Timer = new NoReEnterTimer(Loop, 1000, 500); } catch (Exception ex) { Log.Exception(ex); } }
IEnumerator Start() { Log4ConfigManager.InitLog4net(); Application.logMessageReceived += UnityLogCapturer.ApplicationOnLogMessageReceived; #if !UNITY_EDITOR BootArg = new string[0]; #endif if (null == BootArg) { BootArg = new string[0]; } var bootCmd = CmdParser.ParseCommandLine(BootArg.Length != 0 ? BootArg : System.Environment.GetCommandLineArgs()); QualitySettings.shadowDistance = 120; PlayerPrefs.DeleteKey("unity_server_mode"); _isDestroy = false; var hallController = GetHallController(); if (hallController == null) { #if UNITY_EDITOR SharedConfig.IsOffline = Offline; SharedConfig.IsRobot = IsRobot; SharedConfig.MutilThread = !DisableMutilThread; SharedConfig.DisableDoor = DisableDoor; #endif SharedConfig.InitConfigBootArgs(bootCmd); } else { SharedConfig.IsOffline = false; } SharedConfig.IsServer = false; // 删除是否服务器数据 _logger = new LoggerAdapter(typeof(ClientGameController)); RegisterClientCallback(); InitPhysicsSimulation(); InitCamera(); ComponentAllocateManager.Instance.Init(); if (hallController == null) { _assetLoader = new AssetPool(this); yield return(StartCoroutine(_assetLoader.Init(SingletonManager.Get <ClientFileSystemConfigManager>().BootConfig.Resource, SharedConfig.IsServer))); DoStart(); } else { _assetLoader = AssetPool.Instance; HallUtility.GetGameClientInfo(); _logger.InfoFormat("GetGameClientInfo..."); } MyHttpServer.Start(SingletonManager.Get <ClientFileSystemConfigManager>().BootConfig.HttpPort, _clientRoom); #if UNITY_SOURCE_MODIFIED && !UNITY_EDITOR if (!SharedConfig.InSamplingMode && !SharedConfig.InLegacySampleingMode) { UnityProfiler.EnableProfiler(true); } #endif }