FlexAir擷取MAC地址代碼

來源:互聯網
上載者: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 );                    }                }                     }        }    }}

===============控制台內容:===============

name: {97ED7215-4BDF-4FF1-AB5C-73AE76E87C87}display name: 無線網路串連 2mtu: 1500active?: falseparent interface: nullhardware address: 78-92-9C-06-65-E3# addresses: 2  type: IPv4  address: 169.254.250.76  broadcast: 169.254.255.255  prefix length: 16  type: IPv4  address: 192.168.23.1  broadcast: 192.168.23.255  prefix length: 24name: {C208B292-1BE4-4ADC-9385-C0A40972E216}display name: 本地串連mtu: 1500active?: falseparent interface: nullhardware address: 5C-26-0A-6F-44-26# addresses: 1  type: IPv4  address: 169.254.225.215  broadcast: 169.254.255.255  prefix length: 16name: {D9CEA236-6DEB-4EE6-8646-45C44AC627C9}display name: 無線網路串連mtu: 1500active?: trueparent interface: nullhardware address: 78-92-9C-06-65-E2# addresses: 1  type: IPv4  address: 192.168.2.102  broadcast: 192.168.2.255  prefix length: 24name: {846EE342-7039-11DE-9D20-806E6F6E6963}display name: Loopback Pseudo-Interface 1mtu: -1active?: trueparent interface: nullhardware address:# addresses: 2  type: IPv6  address: ::1  broadcast:  prefix length: 128  type: IPv4  address: 127.0.0.1  broadcast:  prefix length: 8name: {C4A6309C-ED0C-406D-B4AB-295B9223EA5D}display name: Teredo Tunneling Pseudo-Interfacemtu: 1280active?: trueparent interface: nullhardware address: 00-00-00-00-00-00-00-E0# addresses: 1  type: IPv6  address: 2001:0:9d38:6abd:200a:3639:3f57:fd99  broadcast:  prefix length: 64


本文出自 “程式員的技術部落格” 部落格,請務必保留此出處http://programmer.blog.51cto.com/2859493/1286443

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.