C #
get local
IP
Address and
MAC
Address 1, obtain the LAN IP address through the host name; try { iphostentry iphostentry = Dns.gethostentry (Txthost.text);//pass Computer name if (ipHostEntry.Aliases.Length > 0) { foreach (string Alias in iphostentry.aliases) txtip.text = alias; } //Get IP address foreach (IPAddress addr in iphostentry.addres
Java code get computer IP, MAC, various versions Packagecom.rapoo.middle.action;ImportJava.io.BufferedReader;ImportJava.io.InputStream;ImportJava.io.InputStreamReader;Importjava.net.InetAddress;ImportJava.net.NetworkInterface;Importjava.util.ArrayList;ImportJava.util.Formatter;Importjava.util.List;ImportJava.util.Locale;ImportJava.util.Map;Importjava.util.Properties; Public classSystemutil {//Computer Conf
You can use the following code to get the MAC address, depending on your actual needs./*** get MAC address * @param ipAddress127.0.0.1* @return based on IP address * @throws SocketException* @throws unknownhostexception*/publicstatic stringgetlocalmac (stringipaddress) throwssocketexception,unknownhostexception {//TOD
Recently, due to the needs of the project, the need to get the machine's hard drive serial number and MAC address information, under C #, it is easy to obtain this information, but in the C + + program feel more trouble. After Baidu, found that a lot of prawns are through the WMI to obtain these hardware information, the network also has relevant code, through the actual debugging, but also found that it is
First introduce the service and then call the
This paper is reproduced from http://blog.sina.com.cn/s/blog_7eeb43210101hf7f.html
public class Computer {public static string CpuID;//1.cpu serial number public static string MacAddress;//2. Mac serial number public static string DiskID; 3. Hard disk ID public static string ipaddress; 4.ip address public static string loginusername; 5. Login username public static string ComputerName; 6. Computer name
/** * Get MAC Address **/classgetmacaddr{var $return _array=Array();//returns an array of strings with MAC addresses var $mac _addr; functionGETMACADDR ($os _type){ Switch(Strtolower($os _type) ){ Case"Linux":$this-Forlinux (); Break; Case"Solaris": Break; Case"UNIX": Break; Case"Aix": Break;
Our school dormitory uses the wired network, in order to limit other equipment's internet, the school network management will my Computer Ethernet card mac binding static IP, so that the Internet port using other devices will not be able to access the Internet. But I also have the Android phone, the ipad tablet, how to surf the Internet? Technology talent is always respected "technical, unconstrained", because the Internet port is bound to the compute
Public class getip{[Dllimport ("iphlpapi. dll")] // comes with the operating systemPrivate Static extern int sendarp (int32 DEST, int32 host, ref int64 Mac, ref int32 length );[Dllimport ("ws2_32.dll")]Private Static extern int32 inet_addr (string IP );
// Obtain the IP address of the Local MachinePublic String getlocalip (){String strhostname = DNS. gethostname (); // obtain the Host Name of the local machine.Iphostentry ipentry = DNS. gethostbyname
Gets the physical (MAC) address of the machine's network card.Code:
. The code is as follows:
/**
* Get the physical (MAC) address of the machine's network card
* currently supports Win/linux system
**/
class Macaddinfo {
var $return _array = Array (); Returns a string array with a MAC add
In many cases, we need to obtain server hardware information (such as MAC address), commonly used in several ways:• Use a command-line program to get the hard drive information, and then get the output stream via Runtime.getruntime (). exec, then get the MAC address via stri
Recently, there was a need to get the MAC address of the Android device on the JNI layer. Google circled it and did not see the implementation method. So I had to write it myself.
The basic idea is to call the android Java-layer API through JNI to obtain the MAC address of wifi. Theoretically, all JavaCodeCan be translated into JNI code, so it can be implemente
This section shares the PHP code, the main features:
Gets the physical (MAC) address of the machine card.
Code:
Copy CodeThe code is as follows:
/*** Get the physical (MAC) address of the machine card* Currently supports Win/linux system**/Class Macaddinfo {var $return _array = Array (); Returns an array of strings with MAC
Obtain the MAC address source of the network card; the physical (MAC) address of the Win/linux system is currently supported for the machine cardCopy CodeThe code is as follows:/**Obtain the MAC address source of the network card; currently supports Win/linux systemGet the physical (MAC) address of the machine card**/C
There are some ways to get the MAC address on the network as follows:1. Send the ARP command, using the returned MAC address buffer to get2. Use Networkinterface.getallnetworkinterfaces () to obtain all network cards (including virtual network cards) to obtain the appropriate MAC address3. Also available from the local
For a habit of using the Ubuntu terminal on the Apt-get to install the tool software, I also hope to find similar tools on the Mac, a very convenient command to install the required software, instead of manually to find the download compile, or toss the installation of some of the dependencies required. It's a surprise to find that there are similar tool package managers on
There are many ways to get the MAC address of the computer network card, which is obtained by command line , can get the MAC address of the Wired NIC and the wireless card, very simple, directOn the code."1" header file#if!defined (afx_95644697_c78f_4dd6_885b_3d7c40b2d55c__included_) #define Afx_95644697_c78f_4dd6_885b
/**Get the physical (MAC) address of the machine's network cardWWA $Exp**/Class Getmacaddr{var $return _array = Array (); Returns an array of strings with a MAC addressvar $mac _addr;function getmacaddr ($os _type){Switch (Strtolower ($os _type)){Case "Linux":$this->forlinux ();BreakCase "Solaris":BreakCase "UNIX":Brea
"));//Get User nameSystem.out.println (Map.get ("COMPUTERNAME"));//Get Computer nameSystem.out.println (Map.get ("UserDomain"));//Get computer domain name}Get the computer's IP address and MAC addresspublic static mapMaptry{InetAddress address = Inetaddress.getlocalhost ();N
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.