Solved

Machine ID, IP address

Posted on 2001-07-17
8
181 Views
Last Modified: 2013-11-20
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
Comment
Question by:hoooi
  • 4
  • 4
8 Comments
 

Author Comment

by:hoooi
ID: 6291698
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
 
LVL 32

Accepted Solution

by:
jhance earned 50 total points
ID: 6291886
0
 

Author Comment

by:hoooi
ID: 6295416
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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 32

Expert Comment

by:jhance
ID: 6295507
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
 

Author Comment

by:hoooi
ID: 6295601
Then, is the 32-bit number IP address equal to hostent.sin_addr.s_addr?
0
 
LVL 32

Expert Comment

by:jhance
ID: 6295689
Yes, they are equivalent.
0
 

Author Comment

by:hoooi
ID: 6295693
Great. I will copy those codes soon, hope they won't be offline at all.
0
 
LVL 32

Expert Comment

by:jhance
ID: 6295701
That site has been around for quite some time....
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Process filename extension 3 194
CRON statement to run every 3 minutes except on Monday morning 12am to 2am 7 101
has22 challenge 11 104
Making an alias 7 101
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question