///<summary> ///This method Accepts new connections and dispatches them when appropriate. ///</summary> public void StartListen() { while (true) { //Accept a new connection TcpClient client = _myListener.AcceptTcpClient(); SimpleHttpRequest httpReq = new SimpleHttpRequest(client); if (httpReq.HttpMethod == "POST") { try { HttpPost(httpReq); } catch (Exception e) { Logger.WriteEntry("Failed on post: " + e, EventLogEntryType.Error); } } else { Logger.WriteEntry("Only POST methods are supported: " + httpReq.HttpMethod + " ignored", EventLogEntryType.FailureAudit); } httpReq.Close(); } }
///<summary>Close all contained resources, both the HttpReq and client.</summary> public void Close() { if (_httpReq != null) { _httpReq.Close(); _httpReq = null; } if (_client != null) { _client.Close(); _client = null; } }
///<summary> ///This method Accepts new connections and dispatches them when appropriate. ///</summary> public void StartListen() { while(true) { //Accept a new connection TcpClient client = _myListener.AcceptTcpClient(); SimpleHttpRequest httpReq = new SimpleHttpRequest(client); if (httpReq.HttpMethod == "POST") { try { HttpPost(httpReq); } catch (Exception e) { Logger.WriteEntry("Failed on post: " + e, EventLogEntryType.Error); } } else { Logger.WriteEntry("Only POST methods are supported: " + httpReq.HttpMethod + " ignored", EventLogEntryType.FailureAudit); } httpReq.Close(); } }