on 05-07-2007 5:38 PM
Hi,
How can i get the MacAddress of Device on Java?
Regards,
Bruno
Hi
The Bluetooth address serves the same purpose of the MAC address on the network card of your computer; every Bluetooth device has a unique address.
Check out the link below..atleast you can have some idea to initiate.
<a href="http://today.java.net/pub/a/today/2004/07/27/bluetooth.html">http://today.java.net/pub/a/today/2004/07/27/bluetooth.html</a>
Hope this is useful..
Cheers,
kumarR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bruno Ambrozio,
<b>Do check the below link which contains some psedocode which include Mac address.</b>
<a href="http://www.tigoe.net/pcomp/code/archives/lantronix_devices/000315.shtml">Check the pseudocode - Mac Address in Java</a>
Cheers,
kumarR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bruno Ambrozio ,
Check out the code below...May the logic helps u out
IP_ADAPTER_INFO AdapterInfo[16]; // Allocate information
// for up to 16 NICs
DWORD dwBufLen = sizeof(AdapterInfo); // Save memory size of buffer
DWORD dwStatus = GetAdaptersInfo( // Call GetAdapterInfo
AdapterInfo, // [out] buffer to receive data
&dwBufLen); // [in] size of receive data buffer
if (dwStatus != ERROR_SUCCESS)
{
return oa.newString(&java_string("00:00:00:00:00", -1), 0);
} // Verify return value is
// valid, no buffer overflow
PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo; // Contains pointer to
// current adapter info
char buffer[200]="";
if (pAdapterInfo) {
unsigned char MACData[8]={pAdapterInfo->Address[0], pAdapterInfo->Address[1], pAdapterInfo->Address[2], pAdapterInfo->Address[3], pAdapterInfo->Address[4], pAdapterInfo->Address[5], pAdapterInfo->Address[6], pAdapterInfo->Address[7]}; // Print MAC address
sprintf(buffer, "%02X:%02X:%02X:%02X:%02X:%02X", MACData[0], MACData[1], MACData[2], MACData[3], MACData[4], MACData[5]);
}
..for more Check out the link below
<a href="http://www.pdastreet.com/forums/showthread.php?t=30413">http://www.pdastreet.com/forums/showthread.php?t=30413</a>
Cheers,
kumarR
Hi Bruno Ambrozio,
hope this code helps you...
<i>This code will only work in Windows 2000/XP since Microsoft replaced UuidCreate in Windows 2000/XP with one that doesn't use the PC's MAC address.</i>
// Fetches the MAC address and prints it
static void GetMACaddress(void)
{
unsigned char MACData[6];
UUID uuid;
UuidCreateSequential( &uuid ); // Ask OS to create UUID
for (int i=2; i<8; i++) // Bytes 2 through 7 inclusive
// are MAC address
MACData[i - 2] = uuid.Data4<i>;
PrintMACaddress(MACData); // Print MAC address
}
<b>If this is not enough...try out this</b> <a href="http://www.codeguru.com/Cpp/I-N/network/networkinformation/article.php/c5451#more">Link</a>
Cheers,
kumarR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bruno,
Are you working on any wireless application?
1. I succeded in doing this in VC++. You can create a UUID and pull the MAC from there.or can import NDIS miniport driver itself. you open this API documentation you will find the relevant methods for acces in MAC adress.
2. for JAVA you can find this link enumerating all APIs and new enhancements.
http://java.sun.com/j2se/1.4.2/docs/guide/net/enhancements14.html
3. Also, you can look for DHCP.
The Dynamic Host Configuration Protocol (DHCP) is an Internet protocol for automating the configuration of computers that use TCP/IP. DHCP can be used to automatically assign IP addresses, to deliver TCP/IP stack configuration parameters such as the subnet mask and default router, and to provide other configuration information such as the addresses for printer, time and news servers.
http://developers.sun.com/solaris/articles/dhcp-wp.pdf
4. Check this too, if you need in j2ME.
http://articles.techrepublic.com.com/5100-3513_11-6171367.html
Hope this helps. Please feel free to ask for more help.
Regards
Divya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.