Groups | Blog | Home
all groups > macromedia flash flashcom > december 2004 >

macromedia flash flashcom : ip address of a client


rflorico
12/23/2004 3:10:38 PM
Good day to all!

I just want to ask how to get the ip address of a client using flash
communication server mx. I have a code here and it doesn't work. Can someone
help me how to make scripts communicate from client side to server vice and
vise versa, how to pass variables etc. Here's my code by the way.

client side:
out_ns.msgFromSrvr = function (msg){
mytest.text = msg;
}
server side:
application.onConnect(newClient, name){
application.acceptConnection(newClient);
if (newClient.ip == "127.0.0.1"){
var msg = "same ip";
} else {
var msg = "different ip";
}
newClient.call("msgFromSrvr", null , msg);
}

Please help. Thanks in advance!

ion gion
12/30/2004 10:08:33 PM
application.onConnect(newClient, name){
// look in the live log in flash comm app inspector panel.
// it will show you the right ip.
trace(newClient.ip);
application.acceptConnection(newClient);
}
newClient.call("msgFromSrvr", null , msg);
}

then it means that on the client side, on your client connection you will have
this :

// client_nc is your NetworkConnection
client_nc.msgFromSrvr = function(msg)
{
trace(msg);
}

thats it! it works, it is tested.
AddThis Social Bookmark Button