[Mono-list] How to determine local IP address with mono on linux?

Jonel Rienton jonel at rientongroup.com
Thu Mar 23 12:27:36 EST 2006


One ugly hack is to use Process.Start, use ifconfig as the process;

On 3/23/06, Elliott Draper <el at eldiablo.co.uk> wrote:
> Hmm, I can't think of an easy way to retrieve that information from within the .Net/Mono class library, anyone else have any ideas or come across this before?
>
> Cheers,
> -= El =-
>
> On Thu, 23 Mar 2006 18:06:48 +0100, Stephan Eberle <hawke at deltacity.org> wrote:
> > Hi El,
> >
> > That's a good start. Do you know of any possibility to point out the
> > device
> > (eth0, eth1, wlan0, ...) behind each address?
> >
> > Thank's,
> > Stevie
> >
> > On Thursday 23 March 2006 18:03, Elliott Draper wrote:
> >> Hi there,
> >>
> >> Add a reference to System.Net to the top of your code file ("using
> >> System.Net; "), and then try this:
> >>
> >> foreach(IPAddress address in
> >> Dns.GetHostByName(Environment.MachineName).AddressList) {
> >> Console.WriteLine(address.ToString());
> >> }
> >>
> >> That simply prints out each IP address for your local machine to the
> >> console, however you can do whatever you need to do within that
> >> enumeration.
> >>
> >> Hope that helps,
> >> -= El =-
> >>
> >> On Thu, 23 Mar 2006 17:48:34 +0100, Stephan Eberle <hawke at deltacity.org>
> > wrote:
> >> > Hi!
> >> >
> >> > How can I enumerate my machines IP addresses with mono on a linux box?
> >> >
> >> > Any info desperately needed! :)
> >> >
> >> > Thank's in advance,
> >> > Stevie
> >> > _______________________________________________
> >> > Mono-list maillist  -  Mono-list at lists.ximian.com
> >> > http://lists.ximian.com/mailman/listinfo/mono-list
> >>
> >> _______________________________________________
> >> Mono-list maillist  -  Mono-list at lists.ximian.com
> >> http://lists.ximian.com/mailman/listinfo/mono-list
> > _______________________________________________
> > Mono-list maillist  -  Mono-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>


--
Jonel Rienton
mailto:jonel at rientongroup.com


More information about the Mono-list mailing list