How can I retrieve a client's hostname using Flex?
I am building a Flex application which communicates with a Java se开发者_开发技巧rver using BlazeDS.
What would be the best way to go about making the server aware of the client's hostname?
Thanks.
You can't determine the client's hostname from within Flex and it's not possible with JavaScript either. However, you can try to lookup the hostname on the server side using a reverse DNS lookup.
First, you'll need to determine the client's IP address. Take a look at "Can I get the client's IP address in an LCDS service call?" for an example on how to do it in BlazeDS.
In order to get the hostname you need to execute a reverse DNS lookup for the IP address. Please keep in mind that not every IP address has a hostname that can be determined throug reverse DNS lookups.
精彩评论