BonCodeAJP13.BonCodeAJP13ServerConnection.HandleConnection C# (CSharp) Method

HandleConnection() public method

Creates TCP/IP Level network connection to Tomcat
public HandleConnection ( ) : void
return void
        public void HandleConnection()
        {
            //if (p_Logger != null) p_Logger.LogMessage(String.Format("New Connection {0} of {1} to tomcat: {2} ID: {3} [T-{4}]",p_ConcurrentConnections,BonCodeAJP13Settings.MAX_BONCODEAJP13_CONCURRENT_CONNECTIONS, p_TCPClient.Client.RemoteEndPoint.ToString(), p_ThisConnectionID, Thread.CurrentThread.ManagedThreadId), BonCodeAJP13LogLevels.BONCODEAJP13_LOG_BASIC);
            if (p_Logger != null) p_Logger.LogMessage(String.Format("New Connection {0} of {1} to tomcat: {2} ID: {3} [T-{4}]", p_ConcurrentConnections, BonCodeAJP13Settings.MAX_BONCODEAJP13_CONCURRENT_CONNECTIONS, p_TCPClient.Client.RemoteEndPoint.ToString(), p_ThisConnectionID, AppDomain.GetCurrentThreadId()), BonCodeAJP13LogLevels.BONCODEAJP13_LOG_BASIC);
            //get stream set timeouts again (default 30 minutes)
            try
            {

                p_NetworkStream = p_TCPClient.GetStream();
                p_NetworkStream.ReadTimeout = BonCodeAJP13Settings.BONCODEAJP13_SERVER_READ_TIMEOUT;
                p_NetworkStream.WriteTimeout = BonCodeAJP13Settings.BONCODEAJP13_SERVER_WRITE_TIMEOUT;

            }
            catch (Exception ex)
            {
                if (p_Logger != null) p_Logger.LogException(ex, "Stream level -- Server/Port:" + p_Server + "/" + p_Port.ToString());

                string errMsg = "Stream Connection to Tomcat unavailable. Tomcat may be restarting. Please retry later.";
                if (BonCodeAJP13Settings.BONCODEAJP13_TOMCAT_STREAM_ERRORMSG.Length > 1) errMsg = BonCodeAJP13Settings.BONCODEAJP13_TOMCAT_STREAM_ERRORMSG;
                p_PacketsReceived.Add(new TomcatSendBodyChunk(errMsg));

                ConnectionError();
                return;
            }

            //do the rest of the communication (sending packets and receiving response and assembling
            ComunicateWithTomcat();
        }

Usage Example

 public void HandleConnectionTest()
 {
     BonCodeAJP13ServerConnection target = new BonCodeAJP13ServerConnection(); // TODO: Initialize to an appropriate value
     target.HandleConnection();
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }