Esempio n. 1
0
        public void Process(Byte[] abData)
        {
            string sMessage = System.Text.Encoding.ASCII.GetString(abData);

            sMessage = sMessage.Substring(0, sMessage.IndexOf('\r'));

            FtpServerMessageHandler.SendMessage(Id, sMessage);

            string sCommand;
            string sValue;

            int nSpaceIndex = sMessage.IndexOf(' ');

            if (nSpaceIndex < 0)
            {
                sCommand = sMessage.ToUpper();
                sValue   = "";
            }
            else
            {
                sCommand = sMessage.Substring(0, nSpaceIndex).ToUpper();
                sValue   = sMessage.Substring(sCommand.Length + 1);
            }

            FtpCommandHandler handler = m_theCommandHashTable[sCommand] as FtpCommandHandler;

            if (handler == null)
            {
                FtpServerMessageHandler.SendMessage(Id, string.Format("\"{0}\" : Unknown command", sCommand));
                SocketHelpers.Send(Socket, "550 Unknown command\r\n");
            }
            else
            {
                handler.Process(sValue);
            }
        }
Esempio n. 2
0
 public bool Send(byte[] abData, int nSize)
 {
     return(SocketHelpers.Send(m_theSocket, abData, 0, nSize));
 }
Esempio n. 3
0
 public bool Send(char[] abChars, int nSize)
 {
     return(SocketHelpers.Send(m_theSocket, System.Text.Encoding.ASCII.GetBytes(abChars), 0, nSize));
 }
Esempio n. 4
0
 public void Close()
 {
     SocketHelpers.Close(m_theSocket);
     m_theSocket = null;
 }