作者:朱金灿 来源:http://blog.csdn.net/clever101 获取本地IP地址有两种做法.一种是使用gethostname函数,代码如下: bool CSocketComm::GetLocalAddress(std::string& strAddress) { char strHost[HOSTNAME_SIZE] = { 0 }; // get host name, if fail, SetLastError is called if (SOCKET_ERROR != ge
java获取本地计算机MAC地址代码如下: public class SocketMac { //将读取的计算机MAC地址字节转化为字符串 public static String transBytesToStr(byte[] bytes){ StringBuffer buffer = new StringBuffer(); for(int i = 0; i < bytes.length; i++){ if(i != 0) buffer.append("-"); //bytes[