home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!cs.uoregon.edu!news.uoregon.edu!news.uoregon.edu!systems
- From: jfosback@darmok.uoregon.edu (Jason Fosback)
- Newsgroups: comp.sys.next.misc
- Subject: Re: Ethernet id
- Date: 19 Nov 1992 00:25:33 GMT
- Organization: University of Oregon Network Services
- Lines: 69
- Message-ID: <1eemttINNot1@pith.uoregon.edu>
- References: <1992Nov18.142120.25191@cyantic.com>
- NNTP-Posting-Host: darmok.uoregon.edu
-
- In article <1992Nov18.142120.25191@cyantic.com> mark@cyantic.com (Mark
- T. Dornfeld) writes:
- >
- > Anyway, here's another possibility. In NetManager, there is a field
- for
- > storing the ethernet address. Once it has been entered there, it will
- show
- > up in the NetInfo tables. Of course, this all depends on getting the
- > address in the first place, but having it in NetInfo isn't a bad idea
- for
- > general network management.
- > --
- >
- > Mark T. Dornfeld Voice: (416) 234-9048
- > CYANTIC Systems Facsimile: (416)
- 234-0477
- > 101 Subway Crescent Suite 2103 Email: mark@cyantic.com
-
- Here's a previous post to comp.sys.next.programmer with a bit of code to
- get the ehternet address:
-
-
- Newsgroups: comp.sys.next.programmer
- Path:
- nntp.uoregon.edu!usenet.coe.montana.edu!rpi!usc!zaphod.mps.ohio-state.ed
- u!darwin.sura.net!haven.umd.edu!socrates!ice
- From: ice@socrates.umd.edu (Fredrik Nyman)
- Subject: Re: Reading Etherent address from C
- Message-ID: <1992Aug8.150425.14099@socrates.umd.edu>
- Organization: University of Maryland University College
- References: <1992Aug8.141559.212@mintaka.lcs.mit.edu>
- Distribution: usa
- Date: Sat, 8 Aug 1992 15:04:25 GMT
- Lines: 25
-
- cz@silver.lcs.mit.edu (Christopher R. Zach) writes:
-
- >The subject says it all: How does one get the Ethernet Hardware address
- into
- >a C program?
-
-
- The program below should do what you want.
- And no, I didn't write it, I picked it up on the net in one of
- the Sun newsgroups (I think) a couple months ago. Sorry I can't
- give credit where it's due,
-
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <net/if.h>
- #include <netinet/in.h>
- #include <netinet/if_ether.h>
- main()
- { char hname[65];
- struct ether_addr ea;
- gethostname(hname, sizeof(hname));
- ether_hostton(hname, &ea);
- printf("%s\n", ether_ntoa(&ea));
- }
-
- _______________________ end of posting ______________________
-
- -jason
- ______________________________________________________________________
- Jason Fosback, Student Programmer/Consultant| No sir, I didn't like it
- ---- University of Oregon ---- | -R&S
- Internet: jfosback@oregon.uoregon.edu | Star Trek:
- NeXT mail: jfosback@darmok.uoregon.edu | The NeXT Generation...
-