Skip to content

Instantly share code, notes, and snippets.

@masa795
Created September 28, 2013 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masa795/6739965 to your computer and use it in GitHub Desktop.
Save masa795/6739965 to your computer and use it in GitHub Desktop.
IP address取得
string targetSheet = "IP address取得";
if (GUILayout.Button(targetSheet, GUI.skin.button, GUILayout.Width(150), GUILayout.Height(30)))
{
// ホスト名を取得する
string hostname = Dns.GetHostName();
Debug.Log("hostname=" + hostname);
// ホスト名からIPアドレスを取得する
IPAddress[] adrList = Dns.GetHostAddresses(hostname);
foreach (IPAddress address in adrList)
{
Debug.Log(address.ToString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment