/// <summary>
        ///     Creates an instance of Warlight server on given port and given pcs inter network address.
        /// </summary>
        /// <param name="port">Port number.</param>
        /// <returns>Instance of the server prepared to run.</returns>
        public static WarlightServer Create(int port)
        {
            WarlightServer server;

            {
                IPEndPoint endPoint = new IPEndPoint(GetLocalIPAddress(), port);
                server = new WarlightServer(endPoint);
            }

            return(server);
        }
        /// <summary>
        ///     Creates instance of Warlight server based on address and port.
        /// </summary>
        /// <param name="address">Address of the server.</param>
        /// <param name="port">Port where it will be listening on.</param>
        /// <returns>Instance of the server prepared to run.</returns>
        public static WarlightServer Create(IPAddress address, int port)
        {
            WarlightServer server;

            {
                IPEndPoint endPoint = new IPEndPoint(address, port);
                server = new WarlightServer(endPoint);
            }

            return(server);
        }
Example #3
0
        private static void Main(string[] args)
        {
            const string ipAddress = "127.0.0.1";

            Console.WriteLine(ipAddress);
            using (WarlightServer server = WarlightServer.Create(IPAddress.Parse(ipAddress), 5000))
            {
                server.Run(10);
            }
            //using (var db = new WarlightDbContext())
            //{
            //    foreach (var item in db.StartedGames)
            //    {
            //        Console.WriteLine(item);
            //    }
            //}
        }