I'm working with System.Net.Sockets.  I'm trying to get a listing of the
available IPAddress on the machine.  When I run this on my Windows XP box
I get the IP of my NIC: 192.168.2.11.  But when I run this on my Fedora
Core 2 Server I only get 127.0.0.1.  I have 1 NIC on this box that works
fine and is on IP 192.168.2.101.
 
Any idea why the NIC on THE PC would show up fine but not on the Fedora
box?
 
Here is the code I'm using to check for the IPs:
 
using System;
using System.Net;
 
public class Address
{
    public static int Main (string [] args)
    {
     // Getting Ip address of local machine...
     Console.WriteLine ("Local Machine's Host Name: " + 
Dns.GetHostName());
     
 // get the IP address list..
 IPHostEntry ipEntry = Dns.GetHostByName (Dns.GetHostName());
 IPAddress [] addr = ipEntry.AddressList;
 
 Console.WriteLine ("Number of available IPs: " +addr.Length);  
 
 for (int i = 0; i < addr.Length; i++)
 {
     Console.WriteLine ("IP Address {0}: {1} ", i, addr[i].ToString ());
 }
 return 0;
    }    
 }

 

 

Thanks

Reply via email to