コード例 #1
0
        /// <summary>
        /// Add context to the right listener
        ///     share the same prefix
        ///     the longer prefix wins
        /// </summary>
        /// <param name="context"></param>
        internal void AddContext(FtpListenerContext context)
        {
            // Decide which listen should this context added to
            int         prefixLength      = -1;
            FtpListener candidateListener = null;

            foreach (FtpListener listener in m_Listeners)
            {
                if (listener.IsListening)
                {
                    int length = listener.CheckPrefix(context.Request.QueryString);
                    if (length > prefixLength)
                    {
                        candidateListener = listener;
                        prefixLength      = length;
                    }
                }
            }
            if (candidateListener != null)
            {
                candidateListener.AddContext(context);
            }
            else
            {
                if (m_DefaultListener == null)
                {
                    m_DefaultListener = new FtpDefaultListener();
                    m_DefaultListener.Start();
                }
                m_DefaultListener.AddContext(context);
            }
        }
コード例 #2
0
 /// <summary>
 /// Start the ftp server
 /// </summary>
 internal void Start()
 {
     if (!m_IsStarted)
     {
         // Start the socket
         Logging.Print(" Host IP: " + m_HostIP.ToString());
         m_Daemon    = new Thread(WorkerThread);
         m_IsStarted = true;
         m_Daemon.Start();
         if (m_DefaultListener != null)
         {
             if (!m_DefaultListener.IsListening)
             {
                 m_DefaultListener.Start();
             }
         }
         else
         {
             m_DefaultListener = new FtpDefaultListener();
             m_DefaultListener.Start();
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// Add context to the right listener
 ///     share the same prefix
 ///     the longer prefix wins
 /// </summary>
 /// <param name="context"></param>
 internal void AddContext(FtpListenerContext context)
 {
     // Decide which listen should this context added to
     int prefixLength = -1;
     FtpListener candidateListener = null;
     foreach (FtpListener listener in m_Listeners)
     {
         if (listener.IsListening)
         {
             int length = listener.CheckPrefix(context.Request.QueryString);
             if (length > prefixLength)
             {
                 candidateListener = listener;
                 prefixLength = length;
             }
         }
     }
     if (candidateListener != null)
     {
         candidateListener.AddContext(context);
     }
     else
     {
         if (m_DefaultListener == null)
         {
             m_DefaultListener = new FtpDefaultListener();
             m_DefaultListener.Start();
         }
         m_DefaultListener.AddContext(context);
     }
 }
コード例 #4
0
 /// <summary>
 /// Start the ftp server
 /// </summary>
 internal void Start()
 {
     if (!m_IsStarted)
     {
         // Start the socket
         Logging.Print(" Host IP: " + m_HostIP.ToString());
         m_Daemon = new Thread(WorkerThread);
         m_IsStarted = true;
         m_Daemon.Start();
         if (m_DefaultListener != null)
         {
             if (!m_DefaultListener.IsListening)
                 m_DefaultListener.Start();
         }
         else
         {
             m_DefaultListener = new FtpDefaultListener();
             m_DefaultListener.Start();
         }
     }
     
 }