public async Task StartAsync(CancellationToken cancellationToken) { await Task.Factory.StartNew(async() => { _socketTcpServer.Init(); //等待应用程序启动完成后在开启Tcp服务 await Task.Delay(3000, cancellationToken); ConstDefine.CheckUserId = (byte)CommonHelper.MakeCheckUserId(_kj1012CollectionSetting.UserId); var result = _socketTcpServer.Start(new IPEndPoint(IPAddress.Any, _kj1012CollectionSetting.SocketServerPort)); if (!result) { _logger.LogError("socket server start fail"); } }, cancellationToken); }
public void Startup() { log.Info("SharpMUD is starting up..."); _serverConfigManager.LoadSettings(); // // load all from DB as needed _socketServer.Init(); // now for the main loop while (!shutdown) { _connectionManager.ReadInboundBuffers(); // aggression // world update _connectionManager.PushOutboundBuffers(); // sync } Shutdown(); }