home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / next / misc / 22110 < prev    next >
Encoding:
Text File  |  1992-11-18  |  2.7 KB  |  81 lines

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!cs.uoregon.edu!news.uoregon.edu!news.uoregon.edu!systems
  2. From: jfosback@darmok.uoregon.edu (Jason Fosback)
  3. Newsgroups: comp.sys.next.misc
  4. Subject: Re: Ethernet id
  5. Date: 19 Nov 1992 00:25:33 GMT
  6. Organization: University of Oregon Network Services
  7. Lines: 69
  8. Message-ID: <1eemttINNot1@pith.uoregon.edu>
  9. References: <1992Nov18.142120.25191@cyantic.com>
  10. NNTP-Posting-Host: darmok.uoregon.edu
  11.  
  12. In article <1992Nov18.142120.25191@cyantic.com> mark@cyantic.com (Mark  
  13. T. Dornfeld) writes:
  14. > Anyway, here's another possibility.  In NetManager, there is a field  
  15. for
  16. > storing the ethernet address.  Once it has been entered there, it will  
  17. show
  18. > up in the NetInfo tables. Of course, this all depends on getting the
  19. > address in the first place, but having it in NetInfo isn't a bad idea  
  20. for
  21. > general network management.
  22. > -- 
  23. > Mark T. Dornfeld                              Voice: (416) 234-9048
  24. > CYANTIC Systems                               Facsimile: (416)  
  25. 234-0477
  26. > 101 Subway Crescent Suite 2103                Email: mark@cyantic.com
  27.  
  28. Here's a previous post to comp.sys.next.programmer with a bit of code to  
  29. get the ehternet address:
  30.  
  31.  
  32. Newsgroups: comp.sys.next.programmer
  33. Path:  
  34. nntp.uoregon.edu!usenet.coe.montana.edu!rpi!usc!zaphod.mps.ohio-state.ed 
  35. u!darwin.sura.net!haven.umd.edu!socrates!ice
  36. From: ice@socrates.umd.edu (Fredrik Nyman)
  37. Subject: Re: Reading Etherent address from C
  38. Message-ID: <1992Aug8.150425.14099@socrates.umd.edu>
  39. Organization: University of Maryland University College
  40. References: <1992Aug8.141559.212@mintaka.lcs.mit.edu>
  41. Distribution: usa
  42. Date: Sat, 8 Aug 1992 15:04:25 GMT
  43. Lines: 25
  44.  
  45. cz@silver.lcs.mit.edu (Christopher R. Zach) writes:
  46.  
  47. >The subject says it all: How does one get the Ethernet Hardware address  
  48. into
  49. >a C program?
  50.  
  51.  
  52. The program below should do what you want.
  53. And no, I didn't write it, I picked it up on the net in one of
  54. the Sun newsgroups (I think) a couple months ago.  Sorry I can't
  55. give credit where it's due,
  56.  
  57. #include <stdio.h>
  58. #include <sys/types.h>
  59. #include <sys/socket.h>
  60. #include <net/if.h>
  61. #include <netinet/in.h>
  62. #include <netinet/if_ether.h>
  63. main()
  64. {       char hname[65];
  65.         struct ether_addr ea;
  66.         gethostname(hname, sizeof(hname));
  67.         ether_hostton(hname, &ea);
  68.         printf("%s\n", ether_ntoa(&ea));
  69. }
  70.  
  71. _______________________ end of posting ______________________
  72.  
  73. -jason
  74. ______________________________________________________________________
  75. Jason Fosback, Student Programmer/Consultant| No sir, I didn't like it
  76.        ---- University of Oregon ----       |                 -R&S
  77. Internet:  jfosback@oregon.uoregon.edu      | Star Trek:
  78. NeXT mail: jfosback@darmok.uoregon.edu      |  The NeXT Generation...
  79.