Hi
Found a difference between this project and the Windows native HttpListener
It seems that request.RemoteEndPoint goes invalid after respose.outputStream.Close() or after response.Close()
On Windows with the native implementation you can still use RemoteEndPoint after the response close, eg for a Logging Message of "Response Sent back to " + request.RemoteEndPoint.ToString()
Here is a mini example.
private void processHTTPRequest(HttpListenerContext context)
{
HttpListenerRequest request = context.Request;
HttpListenerResponse response = context.Response;
Console.WriteLine(request.RemoteEndPoint);
byte[] output_bytes = {1, 2, 3};
Stream outputStream = response.OutputStream;
outputStream.Write(output_bytes, 0, output_bytes.Length);
outputStream.Close();
Console.WriteLine(request.RemoteEndPoint); // <-- 'request.RemoteEndPoint' threw an exception of type 'System.NullReferenceException' System.Net.IPEndPoint {System.NullReferenceException}
}
It's not the end of the world. I can cache the value.
If you think it is an easy fix, I can fork, test and do a PR.
Thanks, Roger