久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

掃描局域網(wǎng)mac地址

 家住天地 2012-03-13
using System;
using System.Net;
using System.Threading;
using System.Runtime.InteropServices;
namespace LocalIP
{
    class LanSearch
    { /// <summary> /// 取 MAC 地址 /// </summary> /// <param name="DestIP">目標(biāo) IP</param> /// <param name="SrcIP">源 IP</param> /// <param name="pMacAddr">MAC 地址</param> /// <param name="PhyAddrLen">MAC 地址的長(zhǎng)度</param> /// <returns></returns>
      ///
      [DllImport("iphlpapi.dll", ExactSpelling = true)]
      private static unsafe extern int SendARP(int DestIP, int SrcIP, [Out] byte[] pMacAddr, ref int PhyAddrLen);
      /// <summary> /// 在線程中掃描 /// </summary>
      private static void LanSearchThreadMethod()
      {
          int i = Convert.ToUInt16(Thread.CurrentThread.Name);
          Console.Write(".");
          string strIP = "172.18.72." + i.ToString();
          //IPHostEntry ip = null;
          IPAddress ip = null;
          try
          {
              //ip = Dns.GetHostEntry(strIP);
              ip = IPAddress.Parse(strIP);
          }
          catch
          {
              //Console.WriteLine("請(qǐng)勿輸入非法 IP 地址");
              return;
          }
          byte[] b = new byte[6];
          int len = b.Length;
          //int r = SendARP(BitConverter.ToInt32(ip.AddressList[0].G etAddressBytes(), 0), 0, b, ref len);
          int r = SendARP(BitConverter.ToInt32(ip.GetAddressBytes(), 0), 0, b, ref len);
          int num = BitConverter.ToInt32(b, 0);
          string mac = BitConverter.ToString(b, 0, 6);
          if (num != 0)
          {
              //有效 MAC //Console.WriteLine("\r\n{0}--{1}--{2}", ip.AddressList[ 0].ToString(), ip.HostName, mac);
              Console.WriteLine("\r\n{0}--{1}", ip.ToString(), mac);
          }
      }
        /// <summary> /// 程序主入口 /// </summary> /// <param name="args"></param>
        [STAThread]
        static void Main(string[] args)
        {
            Thread[] thread = new Thread[255];
            ThreadStart threadMethod;
            for (int i = 0; i < 255; i++)
            {
                threadMethod = new ThreadStart(LanSearchThreadMethod);
                thread[i] = new Thread(threadMethod);
                thread[i].Name = i.ToString();
                thread[i].Start();
                if (!thread[i].Join(100))
                {
                    thread[i].Abort();
                }
            }
            Console.WriteLine("\r\n 按任意鍵返回");
            Console.ReadLine();
        }
    }
}

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶(hù)發(fā)布,,不代表本站觀點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào),。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約

    類(lèi)似文章 更多