///<summary> ///This method Accepts new connections and dispatches them when appropriate. ///</summary> public void StartListen() { while (true && this._myListener != null) { //Accept a new connection XmlRpcResponder responder = new XmlRpcResponder(this, this._myListener.AcceptTcpClient()); ThreadPool.QueueUserWorkItem(this._wc, responder); } }
/// <summary>The method the thread pool invokes when a thread is available to handle an HTTP request.</summary> /// <param name="responder">TcpClient from the socket accept.</param> public void WaitCallback(object responder) { XmlRpcResponder resp = (XmlRpcResponder)responder; if (resp.HttpReq.HttpMethod == "POST") { try { resp.Respond(); } catch (Exception e) { Logger.WriteEntry(string.Format("Failed on post: {0}", e), LogLevel.Error); } } else { Logger.WriteEntry(string.Format("Only POST methods are supported: {0} ignored", resp.HttpReq.HttpMethod), LogLevel.Error); } resp.Close(); }
///<summary> ///This method Accepts new connections and dispatches them when appropriate. ///</summary> public void StartListen() { while (true && _myListener != null) { //Accept a new connection XmlRpcResponder responder = new XmlRpcResponder(this, _myListener.AcceptTcpClient()); ThreadPool.QueueUserWorkItem(_wc, responder); } }