• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Return an external IP address

Hyperion

Founder
Grab the external IP address of the machine

References:
Code:
using System;
using System.Net;
using System.IO;
using Microsoft.VisualBasic.Devices;
using System.Linq;


Code:
Code:
class ModuleNetwork
{
	public static bool boolfinger = false;
	public static string curl;

	public static void thefinger()
	{
		Computer nComp = new Computer();
		if (nComp.Network.IsAvailable == true)
			boolfinger = true;
		else
			boolfinger = false;
	}

	public static string getip()
	{
		String direction = "";
		WebRequest request = WebRequest.Create("http://checkip.dyndns.org/");
		using (WebResponse response = request.GetResponse())
		using (StreamReader stream = new StreamReader(response.GetResponseStream()))
		direction = stream.ReadToEnd();
            
		int first = direction.IndexOf("Address: ") + 9;
		int last = direction.LastIndexOf("</body>");
		direction = direction.Substring(first, last - first);
		return direction;
	}
}
 
Top