예제 #1
0
        /// <summary>
        /// Send a response on the control connection
        /// </summary>
        private void Respond(uint code, string desc, bool moreFollows)
        {
            string response = code.ToString();

            if (desc != null)
            {
                response += (moreFollows ? '-' : ' ') + desc;
            }

            if (!response.EndsWith("\r\n"))
            {
                response += "\r\n";
            }

            byte[] sendBuffer = EncodeString(response);
            controlSocket.Send(sendBuffer);

            if (logHandler != null)
            {
                logHandler.SentResponse(code, desc);
            }
        }