[Mono-bugs] [Bug 38136][Nor] Changed - System.Net.Sockets.Socket exception when connecting

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Sat, 15 Feb 2003 23:24:07 -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 gonzalo@ximian.com.

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

--- shadow/38136	Sat Feb 15 17:12:49 2003
+++ shadow/38136.tmp.18990	Sat Feb 15 23:24:06 2003
@@ -1,12 +1,12 @@
 Bug#: 38136
 Product: Mono/Class Libraries
 Version: unspecified
 OS: unknown
 OS Details: 
-Status: ASSIGNED   
+Status: NEEDINFO   
 Resolution: 
 Severity: Unknown
 Priority: Normal
 Component: System
 AssignedTo: gonzalo@ximian.com                            
 ReportedBy: alp@atoker.com               
@@ -131,6 +131,35 @@
 ------- Additional Comments From dick@ximian.com  2003-02-15 16:12 -------
 In that case the async Connect method in Socket.cs should be catching
 the exception and Poll()ing for completion, not the runtime code.
 
 ------- Additional Comments From gonzalo@ximian.com  2003-02-15 17:12 -------
 Ok. I'll do it.
+
+------- Additional Comments From gonzalo@ximian.com  2003-02-15 23:24 -------
+The more aproximate solution to the MS behavioud i came up with is
+changing Worker.Connect to be:
+------------------
+lock(result) {
+	bool oldBlock = true;;
+	try {
+		oldBlock = socket.Blocking;
+		if (!oldBlock)
+			socket.Blocking = true;
+			socket.Connect(endpoint);
+	} catch (SocketException e) {
+		throw;
+	} finally {
+		if (!oldBlock)
+			socket.Blocking = false;
+	}
+
+	End();
+----------------------
+
+Btw, in End (), result.IsCompleted shoud be set to true before
+invoking the callback.
+
+The other alternative (catch the exception, check for the
+WSAEINPROGRESS error code and Poll ()) has one problem. How do I know
+if the socket is actually connected? And if not, which error code
+should i set in the exception thrown?