• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

Machine ID, IP address

Please provide console program code to get and display the machine ID and IP address using winsock. I have problem dealing with those sockaddr and hostent. Thanks much.
0
hoooi
Asked:
hoooi
  • 4
  • 4
1 Solution
 
hoooiAuthor Commented:
By machine ID I mean if there is one. On unix machine, when I type hostid, I get an unique string. Is there  something like that on windows? Well, maybe you can tell me how to get the network ID and host id fr the IP address. Thanks.
0
 
hoooiAuthor Commented:
That is great. If you don't mind, can you tell me if there is any unique machine ID? Is hostent.sin_addr.s_addr equivalent to the dotted IP address? I'm just looking for a unique number because it's easier to compare a number than a dotted string.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jhanceCommented:
The MAC address is guaranteed to be unique to the network adapter.  The PC architecture has no other unique ID as Sun and other unix workstations do.

Ragardless, the "dotted string" is ONLY for your convenience.  The IP address is a 32-bit number and the MAC address is a 48-bit number.
0
 
hoooiAuthor Commented:
Then, is the 32-bit number IP address equal to hostent.sin_addr.s_addr?
0
 
jhanceCommented:
Yes, they are equivalent.
0
 
hoooiAuthor Commented:
Great. I will copy those codes soon, hope they won't be offline at all.
0
 
jhanceCommented:
That site has been around for quite some time....
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now