[Mono-bugs] [Bug 73006][Maj] New - Async sockets on MacOS

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 25 Feb 2005 00:36:29 -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 joe-mono@cursive.net.

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

--- shadow/73006	2005-02-25 00:36:28.000000000 -0500
+++ shadow/73006.tmp.22337	2005-02-25 00:36:28.000000000 -0500
@@ -0,0 +1,78 @@
+Bug#: 73006
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: Mac OS 10.3.8
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: joe-mono@cursive.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Async sockets on MacOS
+
+Please fill in this template when reporting a bug, unless you know what you are doing.
+Description of Problem:
+
+System.Net.Sockets.SocketBeginConnect doesn't work on OSX.   It always throws a 
+SocketException: "Socket is already connected".
+
+Steps to reproduce the problem:
+
+Repro program.  Works on Linux, fails on OSX:
+-----
+using System;
+using System.Net;
+using System.Net.Sockets;
+
+public class test_async_sock
+{
+    private static Socket m_sock;
+    
+    public static void Main(string[] args)
+    {
+        m_sock = new Socket(AddressFamily.InterNetwork, 
+                            SocketType.Stream, 
+                            ProtocolType.Tcp);
+        m_sock.Blocking = false;
+        IPAddress addr = IPAddress.Parse("208.245.212.98");
+        m_sock.BeginConnect(new IPEndPoint(addr, 5222),
+                            new AsyncCallback(ExecuteConnect), null);
+        System.Threading.Thread.Sleep(10000);
+    }
+
+    private static void ExecuteConnect(IAsyncResult ar)
+    {
+        try
+        {
+            m_sock.EndConnect(ar);
+            Console.Write("connected");
+        }
+        catch(Exception e)
+        {
+            Console.WriteLine(e);
+        }
+        System.Environment.Exit(0);
+    }
+                            
+}
+-----
+
+Actual Results:
+System.Net.Sockets.SocketException: Socket is already connected
+in <0x00050> SocketAsyncResult:CheckIfThrowDelayedException ()
+in <0x00114> System.Net.Sockets.Socket:EndConnect (System.IAsyncResult)
+in <0x0003c> test_async_sock:ExecuteConnect (System.IAsyncResult)  
+
+Expected Results:
+connected
+
+How often does this happen? 
+Always
+
+Additional Information: