[Mono-bugs] [Bug 36455][Nor] New - get IP-Address
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Wed, 8 Jan 2003 12:42:40 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by ebauermeister@t-online.de.
http://bugzilla.ximian.com/show_bug.cgi?id=36455
--- shadow/36455 Wed Jan 8 12:42:40 2003
+++ shadow/36455.tmp.22439 Wed Jan 8 12:42:40 2003
@@ -0,0 +1,97 @@
+Bug#: 36455
+Product: Mono/Runtime
+Version: unspecified
+OS: SuSE 8.1
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: ebauermeister@t-online.de
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: get IP-Address
+
+Description of Problem:
+
+I am not sure whether this is an bug. The following code does not
+function under Linux, but in Windows. I use Mono 0.17 (Windows and
+Linux):
+
+using System;
+using System.Net;
+using System.Text;
+
+namespace IP_Adresse
+{
+ public class MainClass
+ {
+ public static void GiveIP()
+ {
+ String lineBreak=Environment.NewLine;
+ StringBuilder stringBuilder=new
+ StringBuilder("IP-Adressen").Append(lineBreak).Append(lineBreak);
+ IPHostEntry hostInfo = Dns.GetHostByName("localhost");
+ IPAddress localAdress = hostInfo.AddressList[0];
+ stringBuilder.Append(hostInfo.HostName).
+ Append(": ").Append(localAdress).Append(lineBreak).Append(lineBreak);
+ hostInfo = Dns.GetHostByName(hostInfo.HostName);
+ stringBuilder.Append("Netzwerkadressen:").Append(lineBreak);
+ foreach(IPAddress ipAdress in hostInfo.AddressList)
+ {
+ stringBuilder.Append(hostInfo.HostName).
+ Append(": ").Append(ipAdress).Append(lineBreak);
+ }
+ System.Console.WriteLine(stringBuilder.ToString());
+ System.Console.Read();
+ }
+
+ public static int Main(string[] args)
+ {
+ try{MainClass.GiveIP();}
+ catch (System.Exception ex)
+ {
+ System.Diagnostics.Trace.Write(ex);
+ return 1;
+ }
+ return 0;
+ }
+ }
+}
+
+Actual Results:
+
+Program prints:
+
+IP-Adressen
+
+localhost: 127.0.0.1
+
+Netzwerkadressen:
+localhost: 127.0.0.1
+
+
+Expected Results:
+
+e.G:
+
+IP-Adressen
+
+betty: 127.0.0.1
+
+Netzwerkadressen:
+betty: 193.159.22.120
+
+I get always the name "localhost", not the real hostname.
+The IP of dial in connection (for me ppp0) is always 127.0.0.1
+But under Windows it functions.
+
+How often does this happen?
+
+Always.
+
+Additional Information: