[Mono-bugs] [Bug 81290][Wis] New - SetSocketOption throws an exception using some specific parameters on MAC OS X

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Apr 2 03:33:52 EDT 2007


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 wazabbe at free.fr.

http://bugzilla.ximian.com/show_bug.cgi?id=81290

--- shadow/81290	2007-04-02 03:33:52.000000000 -0400
+++ shadow/81290.tmp.31445	2007-04-02 03:33:52.000000000 -0400
@@ -0,0 +1,107 @@
+Bug#: 81290
+Product: Mono: Class Libraries
+Version: 1.2
+OS: other
+OS Details: MAC OS X 10.4.9
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: wazabbe at free.fr               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: SetSocketOption throws an exception using some specific parameters on MAC OS X
+
+Description of Problem:
+SetSocketOption produces an exception when trying to do a UPNP listener 
+on Mono 1.2 over MAC OS X 10.4.9 while the same peace of code works 
+perfectly on Mono 1.2 over Debian Linux (Sarge) and Windows (.NET 
+Framework 1.1).
+
+Steps to reproduce the problem:
+1. Compile the following code :
+//-----------------------------------------------------------------------
+
+using System;
+using System.Net;
+using System.Net.Sockets;
+
+namespace ConsoleApplication1
+{
+	/// <summary>
+	/// Summary description for Class1.
+	/// </summary>
+	class Class1
+	{
+		/// <summary>
+		/// The main entry point for the application.
+		/// </summary>
+		[STAThread]
+		static void Main(string[] args)
+		{
+			IPAddress[] localAddresses = (Dns.Resolve
+(Dns.GetHostName())).AddressList;
+			if(localAddresses.Length <= 0)return;
+
+			int port;
+
+			Random random = new Random();
+			Socket socket = new Socket
+(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+		
+			do
+			{
+				port = random.Next(0xc350, 0xffdc);
+				IPEndPoint localEP = new IPEndPoint
+(localAddresses[0], port);
+				try
+				{
+					socket.Bind(localEP);
+					break;
+				}
+				catch
+				{
+				}
+			}while(true);
+			socket.Close();
+
+			IPEndPoint LocalEP = new IPEndPoint(localAddresses
+[0], port);
+			Socket ListeningSocket = new Socket
+(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
+			ListeningSocket.SetSocketOption
+(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
+			ListeningSocket.Bind(LocalEP);
+			ListeningSocket.SetSocketOption
+(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption
+(IPAddress.Parse("239.255.255.250"), localAddresses[0]));
+			Console.WriteLine("Worked correctly");
+			ListeningSocket.Close();
+		}
+	}
+}
+
+//-----------------------------------------------------------------------
+
+
+2. Run it under (Debian) Linux, the 'Worked Correctly' text is properly 
+displayed
+3. Run the same executable under MAC OS X 10.4.9, text is not displayed 
+and an exception is thrown
+
+Actual Results:
+An exception is thrown when executing the code
+
+Expected Results:
+The result should be the same under all plateform (and should actually 
+perform well under MAC OS X without throwing an exception).
+
+How often does this happen? 
+Always
+
+Additional Information:
+None


More information about the mono-bugs mailing list