[erlang-questions] inet:ifget("eth0", [broadaddr])

Bob Cowdery bob@REDACTED
Tue Mar 1 22:47:45 CET 2011


I've found another function inet:getifaddrs/0 which returns a host of
information:

{ok,[{"\\DEVICE\\TCPIP_{821E4055-EB4F-4E8A-B7F2-30FF9F055679}",
      [{flags,[up,broadcast,running,multicast]},
       {addr,{65152,0,0,0,13375,30402,12581,1246}},
       {netmask,{65535,65535,65535,65535,0,0,0,0}},
       {addr,{192,168,1,65}},
       {netmask,{255,255,255,0}},
       {broadaddr,{192,168,1,255}},
       {hwaddr,[0,25,209,164,163,180]}]},
     {"\\DEVICE\\TCPIP_{0D3F6CDF-8C9C-441B-AE00-70C76036CE1B}",
      [{flags,[up,broadcast,running,multicast]},
       {addr,{65152,0,0,0,6586,36203,15466,30550}},
       {netmask,{65535,65535,65535,65535,0,0,0,0}},
       {addr,{192,168,56,1}},
       {netmask,{255,255,255,0}},
       {broadaddr,{192,168,56,255}},
       {hwaddr,[8,0,39,0,24,23]}]},
     {"\\DEVICE\\TCPIP_{E29AC6C2-7037-11DE-816D-806E6F6E6963}",
      [{flags,[up,loopback,running]},
       {addr,{0,0,0,0,0,0,0,1}},
       {netmask,{65535,65535,65535,65535,65535,65535,65535,65535}},
       {addr,{127,0,0,1}},
       {netmask,{255,0,0,0}}]},
     {"\\DEVICE\\TCPIP_{D492CD99-E0DE-41CE-9872-FE16A171110D}",
      [{flags,[up]},
       {addr,{65152,0,0,0,0,24318,49320,321}},
       {netmask,{65535,65535,65535,65535,65535,65535,65535,65535}},
       {hwaddr,[0,0,0,0,0,0,0,224]}]},
     {"\\DEVICE\\TCPIP_{CDBD6FCC-4871-4D01-8B5D-E1EC67B4D776}",
      [{flags,[up,running]},
       {addr,{8193,0,24309,31229,6352,13625,11104,54066}},
       {netmask,{0,0,0,0,0,0,0,0}},
       {addr,{65152,0,0,0,6352,13625,11104,54066}},
       {netmask,{0,0,0,0,0,0,0,0}},
       {hwaddr,[0,0,0,0,0,0,0,224]}]},
     {"\\DEVICE\\TCPIP_{24F809A3-F9E8-4A77-83AE-3D00133FDC71}",
      [{flags,[up]},{hwaddr,[0,0,0,0,0,0,0,224]}]}]}

Plugging those somewhat ridiculous names into inet:ifget/0 still gives
einval but at least I can extract the broadaddr from the above structure.

Bob

On 01/03/2011 19:46, Bob Cowdery wrote:
> I'm trying to get hold of the broadcast address on a Windows box but
> inet:ifget() just returns einval. Anyone know of a way to do this.
>
> Thanks
> Bob
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>



More information about the erlang-questions mailing list