ASP access to the network card physical address and code

Author:Anonymous    Updated:2008-10-23 16:21:08
MAC, full name of the Media Access Control

Mac address in the MAC layer is to use the address of the popular point is that the network card physical address, the address of the Mac are generally 6-byte used 48bit (still early in the 2 bytes of 16bit address of the Mac).
The MAC address, as we do not have direct contact with it and so we may not be very familiar with. In the OSI (Open System Interconnection, OSI) 7 layer network protocol (physical layer, data link layer, network layer, transport layer, the session layer, that layer, application layer) reference model, for the second-tier datalink Layer Road (Data Link). It consists of two sub-layer is a layer of the Logical Link Control (LLC: Logical Link Control), that is, we are under a layer of the aforementioned MAC (Media Access Control) layer, that is, the MAC layer. The so-called media (Media), refers to the transmission of signals through a variety of physical environment. Popular media, including cable networks (such as: twisted-pair, coaxial cable, fiber-optic), microwave, laser, infrared, and so on, sometimes also known as the medium for physical media. MAC address, also known as the physical address, hardware address or link address by network equipment manufacturers when written on the internal hardware. The address has nothing to do with the network, which will carry both the hardware address (such as network cards, hubs, routers, etc.) to access the network where it has the same MAC address, MAC address of the general immutable Can not be set by the user.

The following functions can get MAC address:

\ 'Access to the network card physical address
Function GetMACAddress (strIP)
Set net = Server.CreateObject (\ "wscript.network \")
Set sh = Server.CreateObject (\ "wscript.shell \")
sh.run \ "% comspec% / c nbtstat-A \" & strIP & \ "> c: \" & strIP & \ ". txt \", 0, true
Set sh = nothing
Set fso = createobject (\ "scripting.filesystemobject \")
Set ts = fso.opentextfile (\ "c: \" & strIP & \ ". Txt \")
macaddress = null
Do While Not ts.AtEndOfStream
data = ucase (trim (ts.readline))
If instr (data, \ "MAC ADDRESS \") Then
macaddress = trim (split (data, \ "= \") (1))
Exit Do
End If
loop
ts.close
Set ts = nothing
fso.deletefile \ "c: \" & strIP & \ ". txt \"
Set fso = nothing
GetMACAddress = macaddress
End Function

mac = GetMACAddress (\ "you access to the IP address \")
Previous:NO
Next:Html extract the contents of all the picture information code
User Reviews
Site Search
Recommended article
AD