MCConnectionForwarder/Connection forwarder/Program.cs

40 lines
1 KiB
C#
Raw Normal View History

2016-06-15 21:36:57 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Connection_forwarder
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
public static IPAddress GetLocalIP()
{
IPHostEntry host;
IPAddress localIP = IPAddress.Parse("127.0.0.1");
host = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
//localIP = ip.ToString();
localIP = ip;
}
}
return localIP;
}
}
}