[Mono-bugs] [Bug 75436][Wis] Changed - Asynchronous Sockets - BeginConnect does not connect, TcpClient or Telnet can

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Aug 31 20:09:47 EDT 2005


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-ximian at cursive.net.

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

--- shadow/75436	2005-07-01 18:36:43.000000000 -0400
+++ shadow/75436.tmp.1152	2005-08-31 20:09:47.000000000 -0400
@@ -43,6 +43,51 @@
 
 Would appreciate a quick feedback on this, have a delivery tomorrow!
 
 ------- Additional Comments From bmaurer at users.sf.net  2005-07-01 18:36 -------
 Could you provide a test case in the bug report please?
 
+
+------- Additional Comments From joe-ximian at cursive.net  2005-08-31 20:09 -------
+Test case (make sure to have a web server running on localhost first):
+
+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)
+    {
+        Console.WriteLine("socket");
+        m_sock = new Socket(AddressFamily.InterNetwork, 
+                            SocketType.Stream, 
+                            ProtocolType.Tcp);
+        Console.WriteLine("begin");
+        m_sock.Blocking = true;
+        IPAddress addr = IPAddress.Parse("127.0.0.1");
+        m_sock.BeginConnect(new IPEndPoint(addr, 80),
+            new AsyncCallback(ExecuteConnect), null);
+        Console.WriteLine(m_sock.Connected);
+        System.Threading.Thread.Sleep(10000);
+    }
+
+    private static void ExecuteConnect(IAsyncResult ar)
+    {
+        Console.WriteLine("ec");
+
+        try
+        {
+            m_sock.EndConnect(ar);
+            Console.Write("connected");
+        }
+        catch(Exception e)
+        {
+            Console.WriteLine("Error: " + e);
+        }
+        System.Environment.Exit(0);
+    }
+                            
+}
+


More information about the mono-bugs mailing list