public override int WaitForRequestBytes() { if (bufferIndex == -1) { return(m_conn.WaitForRequestBytes()); } return(initialBytes.Length - bufferIndex); }
private void ServeConnection(Socket acceptedSocket) { if (!_shutdownInProgress) { //Connection conn = new Connection(this, acceptedSocket, (System.Security.Cryptography.X509Certificates.X509Certificate)certificate); Connection conn = new Connection(this, acceptedSocket); if (conn.WaitForRequestBytes() == 0) { conn.WriteErrorAndClose(400); return; } ProcessRequest(conn); } }
public void Start() { _socket = CreateSocketBindAndListen(AddressFamily.InterNetwork, _ipAddress, _port); //start the timer DecrementRequestCount(); ThreadPool.QueueUserWorkItem(delegate { while (!_shutdownInProgress) { try { Socket acceptedSocket = _socket.Accept(); ThreadPool.QueueUserWorkItem(delegate { if (!_shutdownInProgress) { Connection conn = new Connection(this, acceptedSocket); if (conn.WaitForRequestBytes() == 0) { conn.WriteErrorAndClose(400); return; } Host host = GetHost(); if (host == null) { conn.WriteErrorAndClose(500); return; } IncrementRequestCount(); host.ProcessRequest(conn); } }); } catch { Thread.Sleep(100); } } }); }
public void StartWithoutAssemblies() { _socket = CreateSocketBindAndListen(AddressFamily.InterNetwork, _ipAddress, _port); //start the timer DecrementRequestCount(); ThreadPool.QueueUserWorkItem(delegate { while (!_shutdownInProgress) { try { Socket acceptedSocket = _socket.Accept(); ThreadPool.QueueUserWorkItem(delegate { if (!_shutdownInProgress) { var conn = new Connection( this, acceptedSocket); if ( conn. WaitForRequestBytes () == 0) { conn. WriteErrorAndClose (400); return; } Host host = GetHost(); if (host == null) { conn. WriteErrorAndClose (500); return; } IncrementRequestCount(); host.ProcessRequest( conn); } }); } catch { Thread.Sleep(100); } } }); }