get mac address... - TCP-IP

This is a discussion on get mac address... - TCP-IP ; On Mac OS X, in C++ I want to get the hardware mac address of the machine... (First device if more than one.) I've seen example that do a pipe ifcongif and grep for the mac address... but surely there ...

+ Reply to Thread
Results 1 to 10 of 10

Thread: get mac address...

  1. get mac address...

    On Mac OS X, in C++
    I want to get the hardware mac address of the machine... (First device
    if more than one.)

    I've seen example that do a pipe ifcongif and grep for the mac
    address... but surely there is a direct api to get the mac address.

    TIA
    B.


  2. Re: get mac address...

    In article <1181343568.380112.146240@j4g2000prf.googlegroups.c om>,
    SpreadTooThin wrote:
    >On Mac OS X, in C++
    >I want to get the hardware mac address of the machine... (First device
    >if more than one.)


    What does it mean for a particular device to be "first" ?
    If I have a built in ethernet, and a built in wireless and
    a firewall connection and a series of USB devices some of which happen
    to have MACs, then which is the -first-? Especially when it comes
    to the USB devices: they are likely to be on a different list
    than the built-in ethernet varieties, so "first" would depend on
    where you looked first.

    Does it matter for your purpose whether the "first" mac is associated
    with a device which is active? (If not, then you're probably trying to
    use the Mac as a machine serial number, which has various associated
    problems.) Does it matter for your purpose whether the "first" mac
    is associated with a removable (and likely to be removed) device?

  3. Re: get mac address...

    SpreadTooThin wrote:
    > On Mac OS X, in C++
    > I want to get the hardware mac address of the machine... (First device
    > if more than one.)
    >
    > I've seen example that do a pipe ifcongif and grep for the mac
    > address... but surely there is a direct api to get the mac address.
    >
    > TIA
    > B.

    The short answer is to get the MAC address from the I/O Registry.
    If you go to this link you can download a zip file which contains
    an example showing the correct system calls to make.
    http://developer.apple.com/samplecod...ess/index.html

  4. Re: get mac address...

    On Jun 8, 6:33 pm, sail0r wrote:
    > SpreadTooThin wrote:
    > > On Mac OS X, in C++
    > > I want to get the hardware mac address of the machine... (First device
    > > if more than one.)

    >
    > > I've seen example that do a pipe ifcongif and grep for the mac
    > > address... but surely there is a direct api to get the mac address.

    >
    > > TIA
    > > B.

    >
    > The short answer is to get the MAC address from the I/O Registry.
    > If you go to this link you can download a zip file which contains
    > an example showing the correct system calls to make.http://developer.apple.com/samplecod...ess/index.html


    Isn't there a more 'generic' unix method? This seems really apple
    specific...
    Like can I send a udp packet to myself or something.....


  5. Re: get mac address...

    On Jun 14, 5:04 pm, SpreadTooThin wrote:
    > On Jun 8, 6:33 pm, sail0r wrote:
    >
    > > SpreadTooThin wrote:
    > > > On Mac OS X, in C++
    > > > I want to get the hardware mac address of the machine... (First device
    > > > if more than one.)

    >
    > > > I've seen example that do a pipe ifcongif and grep for the mac
    > > > address... but surely there is a direct api to get the mac address.

    >
    > > > TIA
    > > > B.

    >
    > > The short answer is to get the MAC address from the I/O Registry.
    > > If you go to this link you can download a zip file which contains
    > > an example showing the correct system calls to make.http://developer.apple.com/samplecod...ess/index.html

    >
    > Isn't there a more 'generic' unix method? This seems really apple
    > specific...
    > Like can I send a udp packet to myself or something.....


    I remember from my old C++ class, an identifier called UUID that
    provides classes for MAC functions. Google UUID and Linux and there
    should be some examples. Theres gotta be a man page out there too.


  6. Re: get mac address...

    On Jun 14, 3:17 pm, Jonny Zuhälter wrote:
    > On Jun 14, 5:04 pm, SpreadTooThin wrote:
    >
    >
    >
    >
    >
    > > On Jun 8, 6:33 pm, sail0r wrote:

    >
    > > > SpreadTooThin wrote:
    > > > > On Mac OS X, in C++
    > > > > I want to get the hardware mac address of the machine... (First device
    > > > > if more than one.)

    >
    > > > > I've seen example that do a pipe ifcongif and grep for the mac
    > > > > address... but surely there is a direct api to get the mac address.

    >
    > > > > TIA
    > > > > B.

    >
    > > > The short answer is to get the MAC address from the I/O Registry.
    > > > If you go to this link you can download a zip file which contains
    > > > an example showing the correct system calls to make.http://developer.apple.com/samplecod...ess/index.html

    >
    > > Isn't there a more 'generic' unix method? This seems really apple
    > > specific...
    > > Like can I send a udp packet to myself or something.....

    >
    > I remember from my old C++ class, an identifier called UUID that
    > provides classes for MAC functions. Google UUID and Linux and there
    > should be some examples. Theres gotta be a man page out there too.- Hide quoted text -
    >
    > - Show quoted text -


    Guess what?! It is a UUID that I'm trying to produce!
    I believe there is a program called uuidgen but my google searches for
    uuidgen.c don't seem to be pointing me to the code..
    Anyone got a pointer to the source?

    TIA.
    B.


  7. Re: get mac address...

    On Thu, 14 Jun 2007 19:11:55 -0700, SpreadTooThin wrote:

    > On Jun 14, 3:17 pm, Jonny Zuhälter wrote:
    >> On Jun 14, 5:04 pm, SpreadTooThin wrote:
    >>
    >>
    >>
    >>
    >>
    >> > On Jun 8, 6:33 pm, sail0r wrote:

    >>
    >> > > SpreadTooThin wrote:
    >> > > > On Mac OS X, in C++
    >> > > > I want to get the hardware mac address of the machine... (First
    >> > > > device if more than one.)

    >>
    >> > > > I've seen example that do a pipe ifcongif and grep for the mac
    >> > > > address... but surely there is a direct api to get the mac
    >> > > > address.

    >>
    >> > > > TIA
    >> > > > B.

    >>
    >> > > The short answer is to get the MAC address from the I/O Registry.
    >> > > If you go to this link you can download a zip file which contains
    >> > > an example showing the correct system calls to
    >> > > make.http://developer.apple.com/samplecod...aryMACAddress/

    index.html
    >>
    >> > Isn't there a more 'generic' unix method? This seems really apple
    >> > specific...
    >> > Like can I send a udp packet to myself or something.....

    >>
    >> I remember from my old C++ class, an identifier called UUID that
    >> provides classes for MAC functions. Google UUID and Linux and there
    >> should be some examples. Theres gotta be a man page out there too.-
    >> Hide quoted text -
    >>
    >> - Show quoted text -

    >
    > Guess what?! It is a UUID that I'm trying to produce! I believe there
    > is a program called uuidgen but my google searches for uuidgen.c don't
    > seem to be pointing me to the code.. Anyone got a pointer to the source?


    Geez! It is easy to get a Mac Address. You just go to Rev's house, and
    look at his door. I'm sure the address is right there.

    Sigh...


    --
    k
    www.perfectreign.com

    making the impossible happen
    ahead of schedule

  8. Re: get mac address...

    PerfectReign wrote:
    > On Thu, 14 Jun 2007 19:11:55 -0700, SpreadTooThin wrote:
    >
    >> On Jun 14, 3:17 pm, Jonny Zuhälter wrote:
    >>> On Jun 14, 5:04 pm, SpreadTooThin wrote:
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>> On Jun 8, 6:33 pm, sail0r wrote:
    >>>>> SpreadTooThin wrote:
    >>>>>> On Mac OS X, in C++
    >>>>>> I want to get the hardware mac address of the machine... (First
    >>>>>> device if more than one.)
    >>>>>> I've seen example that do a pipe ifcongif and grep for the mac
    >>>>>> address... but surely there is a direct api to get the mac
    >>>>>> address.
    >>>>>> TIA
    >>>>>> B.
    >>>>> The short answer is to get the MAC address from the I/O Registry.
    >>>>> If you go to this link you can download a zip file which contains
    >>>>> an example showing the correct system calls to
    >>>>> make.http://developer.apple.com/samplecod...aryMACAddress/

    > index.html
    >>>> Isn't there a more 'generic' unix method? This seems really apple
    >>>> specific...
    >>>> Like can I send a udp packet to myself or something.....
    >>> I remember from my old C++ class, an identifier called UUID that
    >>> provides classes for MAC functions. Google UUID and Linux and there
    >>> should be some examples. Theres gotta be a man page out there too.-
    >>> Hide quoted text -
    >>>
    >>> - Show quoted text -

    >> Guess what?! It is a UUID that I'm trying to produce! I believe there
    >> is a program called uuidgen but my google searches for uuidgen.c don't
    >> seem to be pointing me to the code.. Anyone got a pointer to the source?

    >
    > Geez! It is easy to get a Mac Address. You just go to Rev's house, and
    > look at his door. I'm sure the address is right there.
    >
    > Sigh...
    >
    >

    Heh. Probably half the computers in my neighborhood are Macs so how
    would he know it's me :-)

    --
    I got a fever and the only prescription is more cowbell!
    -Christopher Walken SNL Ă°

  9. Re: get mac address...

    SpreadTooThin wrote:
    > On Jun 8, 6:33 pm, sail0r wrote:
    >> SpreadTooThin wrote:
    >>> On Mac OS X, in C++
    >>> I want to get the hardware mac address of the machine... (First device
    >>> if more than one.)
    >>> I've seen example that do a pipe ifcongif and grep for the mac
    >>> address... but surely there is a direct api to get the mac address.
    >>> TIA
    >>> B.

    >> The short answer is to get the MAC address from the I/O Registry.
    >> If you go to this link you can download a zip file which contains
    >> an example showing the correct system calls to make.http://developer.apple.com/samplecod...ess/index.html

    >
    > Isn't there a more 'generic' unix method? This seems really apple
    > specific...

    re-read you original post!
    You specifically mentioned Mac OS X!!
    *rage burns deep inside*
    > Like can I send a udp packet to myself or something.....

    Yeah, you probably can...
    Then again, I think you need to be WAY MORE ****ING CLEAR IN YOUR POSTS.
    The only reason I am helping you at all is that I am bored as all hell.
    Be grateful I hate my job.
    Anyway, and you better be real ****ing thankful for this,
    go to this link and you should be all set.
    http://forum.java.sun.com/thread.jsp...804&tstart=195



  10. Re: get mac address...

    SpreadTooThin wrote:
    > On Jun 8, 6:33 pm, sail0r wrote:
    >> SpreadTooThin wrote:
    >>> On Mac OS X, in C++
    >>> I want to get the hardware mac address of the machine... (First device
    >>> if more than one.)
    >>> I've seen example that do a pipe ifcongif and grep for the mac
    >>> address... but surely there is a direct api to get the mac address.
    >>> TIA
    >>> B.

    >> The short answer is to get the MAC address from the I/O Registry.
    >> If you go to this link you can download a zip file which contains
    >> an example showing the correct system calls to make.http://developer.apple.com/samplecod...ess/index.html

    >
    > Isn't there a more 'generic' unix method? This seems really apple
    > specific...
    > Like can I send a udp packet to myself or something.....


    Google siocgifconf. It's the socket ioctl() that'll return a big buffer
    that you pick through. It'll give you info on interfaces (IP address
    and IP properties) and links (MAC addresses and so on). The interface
    is complex enough that it'd be worthwhile to search around for some
    example code.

    The output of "netstat -in" maps pretty closely to what you'll get from
    that programmatically. I think that includes the link info - not at my
    mac now.

    Here's an interesting search result. The 1993 date on this man page
    worries me, but the basics look right. Way old versions didn't return
    link information, just interfaces.
    http://developer.apple.com/DOCUMENTA...etintro.4.html

    Good luck,
    John

+ Reply to Thread