Created
September 28, 2013 08:38
-
-
Save masa795/6739965 to your computer and use it in GitHub Desktop.
IP address取得
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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