public WebSocketHttpListenerDuplexStream(HttpRequestStream inputStream, HttpResponseStream outputStream, HttpListenerContext context) { Contract.Assert(inputStream != null, "'inputStream' MUST NOT be NULL."); Contract.Assert(outputStream != null, "'outputStream' MUST NOT be NULL."); Contract.Assert(context != null, "'context' MUST NOT be NULL."); Contract.Assert(inputStream.CanRead, "'inputStream' MUST support read operations."); Contract.Assert(outputStream.CanWrite, "'outputStream' MUST support write operations."); m_InputStream = inputStream; m_OutputStream = outputStream; m_Context = context; if (WebSocketBase.LoggingEnabled) { Logging.Associate(Logging.WebSockets, inputStream, this); Logging.Associate(Logging.WebSockets, outputStream, this); } }
private void EnsureResponseStream() { if (m_ResponseStream==null) { m_ResponseStream = new HttpResponseStream(HttpListenerContext); } }
public AsyncHttpRequest(HttpWebRequest request, TextWriter logWriter, bool debug, Stopwatch stopwatch, HttpResponseStream responseStreamCallback) { m_request = request; m_responseStream = responseStreamCallback; m_logWriter = logWriter; m_DEBUG = debug; m_stopwatch = stopwatch; if (DEBUG) { m_stopwatch.Start(); } if (DEBUG) { m_logWriter.WriteLine("Beginning call to {0} on thread: {1}", request.RequestUri, Thread.CurrentThread.ManagedThreadId); } request.BeginGetResponse(RequestIsComplete, request); }