public Server() { config = new INIReader(System.IO.File.ReadAllLines("config.ini")); chat = new ServerChat(); instance = this; vehicleController = new ServerVehicleController(); api = new ServerApi(this); gamemodeManager = new GamemodeManager(api); gamemodeManager.loadFromFile("gamemodes/" + config.getString("gamemode")); server = new TcpListener(IPAddress.Any, config.getInt("game_port")); server.Start(); server.BeginAcceptTcpClient(onIncomingConnection, null); playerpool = new List<ServerPlayer>(); Timer timer = new Timer(); timer.Elapsed += onBroadcastTimer; timer.Interval = config.getInt("broadcast_interval"); timer.Enabled = true; timer.Start(); UDPStartPort = config.getInt("udp_start_port"); Timer timer_slow = new Timer(); timer_slow.Elapsed += timer_slow_Elapsed; timer_slow.Interval = config.getInt("slow_interval"); timer_slow.Enabled = true; timer_slow.Start(); http_server = new HTTPServer(); Console.WriteLine("Started game server on port " + config.getInt("game_port").ToString()); Console.WriteLine("Started http server on port " + config.getInt("http_port").ToString()); }
public Server() { config = new INIReader(System.IO.File.ReadAllLines("config.ini")); chat = new ServerChat(); instance = this; vehicleController = new ServerVehicleController(); api = new ServerApi(this); gamemodeManager = new GamemodeManager(api); gamemodeManager.loadFromFile("gamemodes/" + config.getString("gamemode")); server = new TcpListener(IPAddress.Any, config.getInt("game_port")); server.Start(); server.BeginAcceptTcpClient(onIncomingConnection, null); playerpool = new List <ServerPlayer>(); Timer timer = new Timer(); timer.Elapsed += onBroadcastTimer; timer.Interval = config.getInt("broadcast_interval"); timer.Enabled = true; timer.Start(); UDPStartPort = config.getInt("udp_start_port"); Timer timer_slow = new Timer(); timer_slow.Elapsed += timer_slow_Elapsed; timer_slow.Interval = config.getInt("slow_interval"); timer_slow.Enabled = true; timer_slow.Start(); http_server = new HTTPServer(); Console.WriteLine("Started game server on port " + config.getInt("game_port").ToString()); Console.WriteLine("Started http server on port " + config.getInt("http_port").ToString()); }