FlexAir obtains the MAC address code

Source: Internet
Author: User

package util{    import com.hurlant.crypto.rsa.RSAKey;    import com.hurlant.util.Hex;                                import flash.display.Sprite;    import flash.net.InterfaceAddress;    import flash.net.NetworkInfo;    import flash.net.NetworkInterface;    import flash.utils.ByteArray;                                public class GetAddress extends Sprite    {        public function GetAddressList():void        {            var networkInfo:NetworkInfo = NetworkInfo.networkInfo;            var interfaces:Vector.<NetworkInterface> = networkInfo.findInterfaces();                                                if( interfaces != null )            {                trace( "Interface count: " + interfaces.length );                for each ( var interfaceObj:NetworkInterface in interfaces )                {                    trace( "\nname: "             + interfaceObj.name );                    trace( "display name: "     + interfaceObj.displayName );                    trace( "mtu: "                 + interfaceObj.mtu );                    trace( "active?: "             + interfaceObj.active );                    trace( "parent interface: " + interfaceObj.parent );                    trace( "hardware address: " + interfaceObj.hardwareAddress );                    if( interfaceObj.subInterfaces != null )                    {                        trace( "# subinterfaces: " + interfaceObj.subInterfaces.length );                    }                    trace("# addresses: "     + interfaceObj.addresses.length );                    for each ( var address:InterfaceAddress in interfaceObj.addresses )                    {                        trace( "  type: "           + address.ipVersion );                        trace( "  address: "         + address.address );                        trace( "  broadcast: "         + address.broadcast );                        trace( "  prefix length: "     + address.prefixLength );                    }                }                     }        }    }}

====================Console content: ======================

Name: {97ED7215-4BDF-4FF1-AB5C-73AE76E87C87} display name: Wireless Network Connection 2mtu: 1500 active?: Falseparent interface: nullhardware address: Alibaba # addresses: 2 type: IPv4 address: Invalid broadcast: 169.254.255.255 prefix length: 16 type: IPv4 address: 192.168.23.1 broadcast: 192.168.23.255 prefix length: 24 name: {C208B292-1BE4-4ADC-9385-C0A40972E216} display name: Local Connection mtu: 1500 active?: Falseparent interface: nullhardware address: Requests # addresses: 1 type: IPv4 address: 169.254.225.215 broadcast: 169.254.255.255 prefix length: 16 name: {D9CEA236-6DEB-4EE6-8646-45C44AC627C9} display name: Wireless Network Connection mtu: 1500 active?: Trueparent interface: nullhardware address: addresses # addresses: 1 type: IPv4 address: 192.168.2.102 broadcast: 192.168.2.255 prefix length: 24 name: {region} display name: Loopback Pseudo-Interface 1mtu: -1 active?: Trueparent interface: nullhardware address: # addresses: 2 type: IPv6 address: 1 broadcast: prefix length: 128 type: IPv4 address: 127.0.0.1 broadcast: prefix length: 8 name: {C4A6309C-ED0C-406D-B4AB-295B9223EA5D} display name: Teredo Tunneling Pseudo-Interfacemtu: 1280 active?: Trueparent interface: nullhardware address: addresses # addresses: 1 type: IPv6 address: 2001: 0: 9d38: 6abd: 200a: 3639: 3f57: fd99 broadcast: prefix length: 64


This article is from the "programmer's technical blog" blog, please be sure to keep this source http://programmer.blog.51cto.com/2859493/1286443

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.