简体   繁体   中英

How to find system(local) IP address in Flex?

I'm working on a project.In that we can register complaints to the IT department about system failure or software failure.
In our company each computer is having unique system(local)IP address

I want my complaint to be registered with that address, by which IT person can identify my system and repair it.
I found many on SO but none solved my problem. Are there any solutions for that? Any suggestions will be very helpful.

this is the way I get the ip-address from a Flex AIR client:

public static function getClientIPAddress (version:String):String {
        var ni:NetworkInfo = NetworkInfo.networkInfo;
        var interfaceVector:Vector.<NetworkInterface> = ni.findInterfaces();
        var currentNetwork:NetworkInterface;

        for each (var networkInt:NetworkInterface in interfaceVector) {
            if (networkInt.active) {
                for each (var address:InterfaceAddress in networkInt.addresses) {
                    if (address.ipVersion == version) {
                        return address.address;
                    }
                }
            }
        }
        return "";
    }

You didn't specify if this was a browser based app or a desktop based AIR App.

The browser based Flash Player will not have access to the IP Address. However, when the Flash Player pings remote services, the IP Address of the request is usually available to that request as a CGI variable. How you access those CGI variables will depend upon the server side language of your choice.

I do not believe that AIR has native access to the IP Address either, however you should be able to get access to it using something like NativeProcess or Native Extensions. You'll have to write some operating system specific code to get at it though.

You cannot do this through Flash Player alone. At this point, you just have to accept that as the final answer. There is not much point in putting a bounty on this . . . if you Google for this, you will find many experts in Flash are frustrated by this limitation from Adobe.

The other answer is correct . . . that is, there are ways to do this if you use Adobe Air, or else non-Adobe methods like CGI, PHP, Java, .NET, etc.

If you want to ask a question about how to do this in .NET, please post it in another question. (Your question as initially asked is a good one, and should be kept on SO as is.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM