[Mono-bugs] [Bug 79576][Wis] New - Exception when stopping HttpListener

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Oct 4 06:14:45 EDT 2006


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 sylvain.taufour at gmail.com.

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

--- shadow/79576	2006-10-04 06:14:45.000000000 -0400
+++ shadow/79576.tmp.4025	2006-10-04 06:14:45.000000000 -0400
@@ -0,0 +1,63 @@
+Bug#: 79576
+Product: Mono: Class Libraries
+Version: 1.0
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: sylvain.taufour at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Exception when stopping HttpListener
+
+Hi,
+
+I want to use HttpListener. All is ok but when I stop the listener an
+exception is rise and the framework crash.
+
+Source code :
+HttpListener srvWeb = new HttpListener();
+srvWeb.Prefixes.Add("http://+:81/");
+srvWeb.Start();
+
+HttpListenerContext ctx = srvWeb.GetContext();
+
+string file = ctx.Request.Url.LocalPath;
+
+string rep = "<html><head><title>test</title></head><body><p>" + file +
+"</p></body></html>";
+
+StreamWriter sw = new StreamWriter(ctx.Response.OutputStream);
+sw.Write(rep);
+sw.Flush();
+sw.Close();
+
+ctx.Response.Close();
+
+srvWeb.Stop(); //here the exception, if I delete it no problem
+
+The exception produce in the class EndPointListener, methode OnAccept
+static void OnAccept (IAsyncResult ares)
+{
+	EndPointListener epl = (EndPointListener) ares.AsyncState;
+	Socket accepted = null;
+	try {
+		accepted = epl.sock.EndAccept (ares);
+	} catch {
+		// Anything to do here?
+	} finally {
+		epl.sock.BeginAccept (OnAccept, epl); // here exception
+	}
+
+	HttpConnection conn = new HttpConnection (accepted, epl, epl.secure);
+	conn.BeginReadRequest ();
+}
+
+The exception is can't access to a deleted object, name of the object :
+'System.Net.Sockets.Socket'


More information about the mono-bugs mailing list