- Home /
Question by
darkal · Jun 15, 2014 at 04:29 PM ·
javascriptnetworkingnetwork
pull ip address of computer
my code works fine but i need to pull the ip address off the computer as soon as the server is made
var pass1 = "";//password of the server
var passinput1 = "";//password u type for server
var servercount = 0;//number of servermade
var servername = "";//when making server name
var serverpass = "";//when making server password
var servermade : boolean = true; //shows that server was made
var makeserver : boolean = false;//allows you to make a server
var serverlist : boolean = false;//shows server list
var y = 25;//hides servers untel they are made
var client : GameObject;
var spot : Transform;
function Update ()
{
if(servermade)
{
name1 = servername;
pass1 = serverpass;
y += 25;
servercount += 1;
servername = "";
serverpass = "";
if(servercount > 0)
servermade = false;
}
}
function OnGUI ()
{
if(GUI.Button(Rect(0, 0, 100, 50), "makeserver"))
{
makeserver = !makeserver;
}
if(makeserver)
{
servername = GUI.TextArea(Rect(100, 0, 200, 25), servername);
serverpass = GUI.TextArea(Rect(100, 25, 200, 25), serverpass);
if(GUI.Button(Rect(300, 0, 100, 50), "save"))
{
Instantiate(client,spot.position,spot.rotation);
servermade = true;
}
}
if(GUI.Button(Rect(0, 50, 100, 200), "serverlist"))
{
serverlist = !serverlist;
}
if(serverlist)
{
GUI.Box(Rect(100, 50, 200, 25), "servername");
GUI.Box(Rect(300, 50, 100, 25), "serverpass");
GUI.Box(Rect(400, 50, 100, 25), "maxplayers");
}
}
Comment
Answer by fholm · Jun 16, 2014 at 08:33 AM
This requires platform specific code for each OS. Check out the network interfaces API on msdn
Platform specific code is almost never the answer. The whole idea behind the $$anonymous$$ono
project is to port .NET to all operating systems. Any .NET library works the same on every operating system (therefore platform independent).
Answer by Benproductions1 · Jun 16, 2014 at 10:29 AM
Note that Unity is .NET based, so all .NET documentation also works for Unity. Please see .NET DNS Documentation
do you have a link that has java script? one you sent me doesnt have that