獲取本機實體地址

2021-10-05 06:16:27 字數 1199 閱讀 4338

第一種:只拿到純數字的

'獲取實體地址

dim strmacaddress as string = string.empty

dim nics() as networkinte***ce = networkinte***ce.getallnetworkinte***ces()

strmacaddress = nics(0).getphysicaladdress.tostring

第二種:中間有連線符號

'獲取實體地址

dim macs as list(of string) = new list(of string)

dim startinfo as processstartinfo = new processstartinfo("ipconfig", "/all")

startinfo.useshellexecute = false

startinfo.redirectstandardinput = true

startinfo.redirectstandardoutput = true

startinfo.redirectstandarderror = true

startinfo.createnowindow = true

dim p as process = process.start(startinfo) '擷取輸出流

dim reader as streamreader = p.standardoutput

dim line as string = reader.readline()

while not reader.endofstream

if not isnothing(line) then

line = line.trim()

if line.startswith("實體地址") then

macs.add(line.substring(line.indexof(":") + 1))

end if

end if

line = reader.readline()

end while

'等待程式執行完退出程序

p.waitforexit()

p.close()

reader.close()

strmacvalue = macs(0)

如何獲取本機網絡卡的實體地址

如何獲取本機網絡卡的實體地址 編號 qa001310 建立日期 1999年7月9日 最後修改日期 2005年8月22日 所屬類別 c c 網路與通訊 使用的作業系統 win95 使用的程式設計工具 vc 5.0 遇到的問題 如何獲取本機網絡卡的實體地址?qiang pu 由於nt機中可以同時安裝多網...

ASP獲取網絡卡實體地址(MAC)

mac,全稱 media access control mac位址就是在 接入層上使用的位址,通俗點說就是網絡卡的實體地址,現在的mac位址一般都採用6位元組48bit 在早期還有2位元組16bit的mac位址 對於mac位址,由於我們不直接和它接觸,所以大家不一定很熟悉。在osi open sys...

實體地址(MAC位址)

編輯 在 儲存器裡以 位元組為單位儲存資訊,為正確地存放或取得資訊,每乙個位元組單元給以乙個唯一的 儲存器位址,稱為實體地址 physical address 又叫 實際位址或 絕對位址。實體地址 段位址 16d 偏移位址 mac位址也叫實體地址 硬體位址。網路裝置製造商生產時寫在硬體內部。mac位...