Get Server ip/url in Actionscript serverside extension

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

_stooge
Posts: 3
Joined: 03 Jan 2012, 16:06

Get Server ip/url in Actionscript serverside extension

Postby _stooge » 03 Jan 2012, 16:10

hi everyone,

is there a way to retrieve the SF server ip/url in a Actionscript server-side extension?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 03 Jan 2012, 19:19

Hi.

Well, ActionScript by itself can't do that directly, but you can run Java classes in the ActionScript extensions. In java yes, it looks like its possible to retrieve the ip address, I suggest you to check this link, it has there the code to get the ip address.

You can check this chapter of the docs to check how to use Java in ActionScript extensions.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
_stooge
Posts: 3
Joined: 03 Jan 2012, 16:06

Postby _stooge » 05 Jan 2012, 15:22

Thanks rjgtav! I'll check those links out :)
_stooge
Posts: 3
Joined: 03 Jan 2012, 16:06

Postby _stooge » 05 Jan 2012, 17:01

Just in case anyone else needed this, I'll paste the as code for the extension. It's my very first ext so please don't be too strict :)
(thanks again to rjgtav for pointing me to those links!)

Code: Select all

function init () {
   var lh = java.net.InetAddress.getLocalHost();
   var ip = lh.getHostAddress();
   trace("IP: "+ip)
}


function destroy()
{
   trace("Bye bye!")
}


function handleRequest(cmd, params, user, fromRoom){
// code here...
}

function handleInternalEvent(evt)
{
// code here...
}

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 60 guests