[Mono-bugs] [Bug 432892] New: Overloaded Send()-Methods in System.Net. NetworkInformation.Ping return diffrent results
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue Oct 7 02:32:02 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=432892
Summary: Overloaded Send()-Methods in
System.Net.NetworkInformation.Ping return diffrent
results
Product: Mono: Class Libraries
Version: 2.0
Platform: i686
OS/Version: openSUSE 11.0
Status: NEW
Severity: Normal
Priority: P5 - None
Component: System
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: j.hofmann at ontiv.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
If just tried new VMware-Image (OpenSuse 11.0, Mono 2.0) and run a small
application that i developed with .NET (Windows XP, Visual Studio 2008). This
application uses the System.Net.NetworkInformation.Ping class to ping an
computer (default gateway) in the local network. Using the Ping-class under
Mono throws an exception (see below), so I tried the overloaded Send()-Methods
of the Ping-class to get around the exception, but i get diffrent results.
Using Send(byte[]) returns a PingReply with IPStatus.Success, while the
Send(string) throws an exception.
The VM has internet connection and i can ping the host system (using shell).
Host system can ping the VM, too.
I´ve read somewhere that Ping under Linux, works diffrently than on Windows,
so i don´t know if its a bug.
Here´s the code:
using System;
using System.Net.NetworkInformation;
using System.Net;
namespace pingtest {
class MainClass{
public static void Main(string[] args){
Ping p = new System.Net.NetworkInformation.Ping();
byte[] ip = new byte[4]{192,168,73,110}; //ip of default gateway
//IPHostEntry entry = Dns.GetHostEntry(new IPAddress(ip));
//Console.WriteLine(entry.HostName);
PingReply reply = p.Send(new IPAddress(ip));
Console.WriteLine(reply.Status.ToString());
System.Diagnostics.Debug.Assert(reply.Status == IPStatus.Success);
reply = p.Send("192.168.73.110"); // ip of default gateway
Console.WriteLine(reply.Status.ToString());
System.Diagnostics.Debug.Assert(reply.Status == IPStatus.Success);
}
}
}
Output:
Success
Unhandled Exception: System.Net.Sockets.SocketException: No such host is known
at System.Net.Dns.hostent_to_IPHostEntry (System.String h_name,
System.String[] h_aliases, System.String[] h_addrlist) [0x000aa] in
/usr/src/packages/BUILD/mono-2.0/mcs/class/System/System.Net/Dns.cs:211
at System.Net.Dns.GetHostByAddressFromString (System.String address, Boolean
parse) [0x00045] in
/usr/src/packages/BUILD/mono-2.0/mcs/class/System/System.Net/Dns.cs:273
at System.Net.Dns.GetHostEntry (System.Net.IPAddress address) [0x00011] in
/usr/src/packages/BUILD/mono-2.0/mcs/class/System/System.Net/Dns.cs:297
at System.Net.Dns.GetHostEntry (System.String hostNameOrAddress) [0x00045] in
/usr/src/packages/BUILD/mono-2.0/mcs/class/System/System.Net/Dns.cs:287
at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress,
Int32 timeout, System.Byte[] buffer, System.Net.NetworkInformation.PingOptions
options) [0x00000] in
/usr/src/packages/BUILD/mono-2.0/mcs/class/System/System.Net.NetworkInformation/Ping.cs:162
at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress,
Int32 timeout, System.Byte[] buffer) [0x00000] in
/usr/src/packages/BUILD/mono-2.0/mcs/class/System/System.Net.NetworkInformation/Ping.cs:157
at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress,
Int32 timeout) [0x00000] in
/usr/src/packages/BUILD/mono-2.0/mcs/class/System/System.Net.NetworkInformation/Ping.cs:152
at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress)
[0x00000] in
/usr/src/packages/BUILD/mono-2.0/mcs/class/System/System.Net.NetworkInformation/Ping.cs:147
at (wrapper remoting-invoke-with-check)
System.Net.NetworkInformation.Ping:Send (string)
at pingtest.MainClass.Main (System.String[] args) [0x00046] in
/home/linux/pingtest/pingtest/Main.cs:24
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list