Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string GetIPs(string args)
- {
- string[] combinedString;
- List<string> IPAdressenLijst = new List<string>();
- IPAddress[] ips = Dns.GetHostAddresses(Dns.GetHostName());
- foreach (IPAddress ip in ips)
- {
- if (ip.AddressFamily == AddressFamily.InterNetwork)
- {
- if (args == "program")
- {
- IPAdressenLijst.Add("http://" + ip + ":1337/");
- combinedString = IPAdressenLijst.ToArray();
- }
- else if (args == "webserver")
- {
- IPAdressenLijst.Add("http://" + ip + ":1337/start/");
- IPAdressenLijst.Add("http://" + ip + ":1337/stop/");
- combinedString = IPAdressenLijst.ToArray();
- }
- }
- }
- return combinedString[0];
- }
- static void Main(string[] args)
- {
- Console.WriteLine(DateTime.Now + " Press any key to exit.");
- //WebServer ws = new WebServer(SendResponse, "http://192.168.0.107:1337/", "http://localhost:1337/");
- WebServer ws = new WebServer(SendResponse, IPs.GetIPs("program"));
- ws.Run();
- Console.ReadKey();
- ws.Stop();
- }
- public class WebServer
- {
- //static string[] uris =
- //{
- // "http://192.168.0.107:1337/start/",
- // "http://192.168.0.107:1337/stop/"
- //};
- static string[] uris =
- {
- IPs.GetIPs("webserver")
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement