[Mono-bugs] [Bug 344163] HttpListener - Not accepting local connections
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri Nov 30 20:51:11 EST 2007
https://bugzilla.novell.com/show_bug.cgi?id=344163#c4
--- Comment #4 from Alan McGovern <alan.mcgovern at gmail.com> 2007-11-30 18:51:09 MST ---
No, there is definitely a difference in behavior here.
Running the code in #1 under MS.NET, it immediately prints out that a
connection has been received. Under mono you *never* see 'Got the request'
printed because the connection is *never* received by the listener.
In the slightly altered snippet attached to the end of this post, there is
another buggy behavior visible which is probably the root cause of the issue.
In this testcase, i call EndGetRequestStream immediately after calling
BeginGetRequestSteam. On mono this throws an exception (because the webreqest
failed), on MS.NET the call blocks because the listeners EndGetContext method
is never called to handle the request and write the response.
using System;
using System.Net;
namespace TCP
{
class Tester
{
static void Main(string[] args)
{
string location = string.Format("http://{0}:{1}/",
IPAddress.Loopback.ToString(), 10000);
HttpListener listener = new HttpListener();
listener.Prefixes.Add(location);
listener.Start();
IAsyncResult listenerResult = listener.BeginGetContext(null, null);
WebRequest webRequest =
WebRequest.Create("http://localhost:10000");
IAsyncResult requestResult = webRequest.BeginGetResponse(null,
null);
//HttpListenerContext context =
listener.EndGetContext(listenerResult);
webRequest.EndGetResponse(requestResult);
Console.WriteLine("Got the request");
Console.ReadLine();
}
}
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list