Example #1
0
        /// <summary>
        /// Starts the web server.
        /// </summary>
        public void Start(string websitePath, int port = 80, bool acquirePublicIP = false)
        {
            OnError.IfNull(() => Console.WriteLine("Warning - the onError callback has not been initialized by the application."));

            if (acquirePublicIP)
            {
                publicIP = GetExternalIP();
                Console.WriteLine("public IP: " + publicIP);
            }

            router.WebsitePath = websitePath;
            List <IPAddress> localHostIPs = GetLocalHostIPs();
            HttpListener     listener     = InitializeListener(localHostIPs, port);

            Start(listener);
        }