/// <summary> /// Creates and runs a <seealso cref="Server"/>. /// </summary> /// <param name="_maxPlayers">The maximum number of clients that can connect to the server.</param> /// <param name="_port">The port to run on.</param> public static void Start(int _maxPlayers, int _port) { maxPlayers = _maxPlayers; port = _port; LogMan.Initialize(); LogMan.Info($"Copyright (c) {DateTime.Now.Year} Gideon Grinberg. Subject to the terms of the Mozilla PublicLicense, v. 2.0."); LogMan.Info($"Starting server."); try { tcpListener = new TcpListener(IPAddress.Any, port); tcpListener.Start(); tcpListener.BeginAcceptTcpClient(new AsyncCallback(TCPConnectCallback), null); LogMan.Info($"Listening for connections on port {port}. Max players is currently set to {_maxPlayers}"); } catch (Exception ex) { LogMan.Info($"ERROR: Failed to start TCP server. Exception: \n {ex}"); } InitializeServerData(); LogMan.Info("Finished initializing server!"); }