vc编写linux安装ftp客户端端

老外用VC++写的小型FTP服务器源代码 展示 ConnectSocket.cpp源代码
- 下载整个 - 类型:.cpp文件
/********************************************************************/
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* &CONNECTSOCKET.CPP & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* &Implementation of the Connect Socket. & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/*& & & This class is a part of the ConnectThread which handles & & & & & & & & */
/* &socket connections. Incomming data is processed in OnReceive& & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* &Programmed by Pablo van der Meer& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/*& & & http://www.pablovandermeer.nl & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* &Last updated: 10 july 2002& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/********************************************************************/
#include &stdafx.h&
#include &FTPServerApp.h&
#include &FTPServer.h&
#include &ConnectSocket.h&
#include &ConnectThread.h&
#include &ApplicationDlg.h&
#include &DataSocket.h&
extern CFTPServer theServer;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
/********************************************************************/
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* Function name : CConnectSocket::CConnectSocket & & & & & & & & & & & & & & & & & & & */
/* Description & : Constructor& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/********************************************************************/
CConnectSocket::CConnectSocket()
& & & & m_bLoggedon = FALSE;
& & & & m_bRenameFile = FALSE;
& & & & // reset transfer status
& & & & m_TransferStatus.m_pDataSocket = NULL;
& & & & m_TransferStatus.m_strRemoteHost = &&;
& & & & m_TransferStatus.m_nRemotePort = -1;
& & & & m_TransferStatus.m_bPassiveMode = FALSE;
& & & & m_TransferStatus.m_nRest = -1;
/********************************************************************/
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* Function name : CConnectSocket::~CConnectSocket& & & & & & & & & & & & & & & & & & & */
/* Description & : Destructor & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/********************************************************************/
CConnectSocket::~CConnectSocket()
& & & & DestroyDataSocket();
& & & & // tell our thread we have been closed
& & & & AfxGetThread()-&PostThreadMessage(WM_QUIT,0,0);
& & & & TRACE0(&CConnectSocket destroyed.\n&);
// Do not edit the following lines, which are needed by ClassWizard.
BEGIN_MESSAGE_MAP(CConnectSocket, CSocket)
& & & & //{{AFX_MSG_MAP(CConnectSocket)
& & & & //}}AFX_MSG_MAP
END_MESSAGE_MAP()
#endif& // 0
/********************************************************************/
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* Function name : OnClose& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */& & & & & & &
/* Description & : Send WM_QUIT message to the thread containing& & & & */
/*& & & & & & & & & & & & & & & & &the socket to shutdown once the connection is& & & & */
/* & & & & & & & & closed.& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/********************************************************************/
void CConnectSocket::OnClose(int nErrorCode)
& & & & Close();
& & & & // destroy connection
& & & & m_pThread-&PostThreadMessage(WM_THREADMSG, 1, 0);
& & & & TRACE(&CConnectSocket() OnClose()\n&);
& & & & CSocket::OnClose(nErrorCode);
#define BUFFERSIZE 4096
/********************************************************************/
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* Function name : OnReceive& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */& & & & & & &
/* Description & : Called by the framework to notify this socket& & & & */
/* & & & & & & & & that there is data in the buffer.& & & & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/********************************************************************/
void CConnectSocket::OnReceive(int nErrorCode)
& & & & TCHAR buff[BUFFERSIZE];
& & & & int nRead = Receive(buff, BUFFERSIZE);
& & & & switch (nRead)
& & & & {
& & & & & & & & case 0:
& & & & & & & & & & & & Close();
& & & & & & & & & & & & break;
& & & & & & & & case SOCKET_ERROR:
& & & & & & & & & & & & if (GetLastError() != WSAEWOULDBLOCK)
& & & & & & & & & & & & {
& & & & & & & & & & & & & & & & TCHAR szError&#91;<span style="color: #&#93;;
& & & & & & & & & & & & & & & & wsprintf&#40;szError, &OnReceive error: %d&, GetLastError&#40;&#41;&#41;;
& & & & & & & & & & & & & & & &
& & & & & & & & & & & & & & & & AfxMessageBox &#40;szError&#41;;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & break;
& & & & & & & & default:
& & & & & & & & & & & & if &#40;nRead != SOCKET_ERROR && nRead != 0&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & &#40;&#40;CConnectThread *&#41;AfxGetThread&#40;&#41;&#41;-&IncReceivedBytes&#40;nRead&#41;;
& & & & & & & & & & & & & & & & // terminate the string
& & & & & & & & & & & & & & & & buff&#91;nRead&#93; = 0;
& & & & & & & & & & & & & & & & m_RxBuffer += CString&#40;buff&#41;;
& & & & & & & & & & & & & & & &
& & & & & & & & & & & & & & & & GetRxLine&#40;&#41;;
& & & & & & & & & & & & &#125; & & &
& & & & & & & & & & & & break;
& & & & &#125;
& & & & CSocket::OnReceive&#40;nErrorCode&#41;;
/********************************************************************/
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* Function name: GetRxCommand& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */& & & & & & &
/* Description &: Get command from receiver buffer. & & & & & & & & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/********************************************************************/
BOOL CConnectSocket::GetRxCommand&#40;CString &strCommand, CString &strArguments&#41;
& & & & if &#40;!m_strCommands.IsEmpty&#40;&#41;&#41;
& & & & &#123;
& & & & & & & & CString strBuff = m_strCommands.RemoveHead&#40;&#41;;
& & & & & & & & int nIndex = strBuff.Find&#40;& &&#41;;
& & & & & & & & if &#40;nIndex != -1&#41;
& & & & & & & & &#123;
& & & & & & & & & & & & CString strPassword = strBuff;
& & & & & & & & & & & & strPassword.MakeUpper&#40;&#41;;
& & & & & & & & & & & & // make password invisible
& & & & & & & & & & & & if &#40;strPassword.Left&#40;5&#41; == &PASS &&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & strPassword = strBuff.Left&#40;5&#41;;
& & & & & & & & & & & & & & & & for &#40;int i=0; i&strBuff.GetLength&#40;&#41;-5; i++&#41;
& & & & & & & & & & & & & & & & & & & & strPassword += &*&;
& & & & & & & & & & & & & & & & FireStatusMessage&#40;strPassword, 1&#41;;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & else
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & FireStatusMessage&#40;strBuff, 1&#41;;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & strCommand = strBuff.Left&#40;nIndex&#41;;
& & & & & & & & & & & & strArguments = strBuff.Mid&#40;nIndex+1&#41;;
& & & & & & & & &#125;
& & & & & & & & else
& & & & & & & & &#123;
& & & & & & & & & & & & FireStatusMessage&#40;strBuff, 1&#41;;
& & & & & & & & & & & & strCommand = strBuff;
& & & & & & & & &#125;
& & & & & & & & if &#40;strCommand != &&&#41;
& & & & & & & & &#123;
& & & & & & & & & & & & strCommand.MakeUpper&#40;&#41;;
& & & & & & & & & & & & // who screwed up ???
& & & & & & & & & & & & if &#40;strCommand.Right&#40;4&#41; == &ABOR&&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & strCommand = &ABOR&;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & &
& & & & & & & & & & & & TRACE2&#40;&COMMAND: %s, ARGS: %s\n&, strCommand, strArguments&#41;;
& & & & & & & & & & & & return TRUE;
& & & & & & & & &#125;
& & & & &#125;
& & & & return FALSE;
/********************************************************************/
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* Function name: GetRxLine & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */& & & & & & &
/* Description &: Parse complete command line & & & & & & & & & & & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/********************************************************************/
void CConnectSocket::GetRxLine&#40;&#41;
& & & & CString strTemp;
& & & & int nIndex;
& & & & while&#40;!m_RxBuffer.IsEmpty&#40;&#41;&#41;
& & & & &#123;
& & & & & & & & nIndex = m_RxBuffer.Find&#40;&\r\n&&#41;;
& & & & & & & & if &#40;nIndex != -1&#41;
& & & & & & & & &#123;
& & & & & & & & & & & & strTemp = m_RxBuffer.Left&#40;nIndex&#41;;
& & & & & & & & & & & & m_RxBuffer = m_RxBuffer.Mid&#40;nIndex + 2&#41;;
& & & & & & & & & & & & if &#40;!strTemp.IsEmpty&#40;&#41;&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & m_strCommands.AddTail&#40;strTemp&#41;;
& & & & & & & & & & & & & & & & // parse and execute command
& & & & & & & & & & & & & & & & ParseCommand&#40;&#41;;
& & & & & & & & & & & & &#125;
& & & & & & & & &#125;
& & & & & & & & else
& & & & & & & & & & & & break;
& & & & &#125;
/********************************************************************/
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* Function name: OnConnect & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */& & & & & & &
/* Description &: Called by the framework to notify this connecting & & */
/*& & & & & & & & & & & & & & & & socket that its connection attempt is completed. &*/
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/********************************************************************/
void CConnectSocket::OnConnect&#40;int nErrorCode&#41;
& & & & CSocket::OnConnect&#40;nErrorCode&#41;;
/********************************************************************/
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* Function name: HasConnectionDropped& & & & & & & & & & & & & & & & & & & & & & & & & & & & & */& & & & & & &
/* Description &: Check if connection has been dropped. & & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & Used to detect if client has crashed. & & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/********************************************************************/
BOOL CConnectSocket::HasConnectionDropped&#40;void&#41;
& & & & BOOL bConnDropped = FALSE;
& & & & INT iRet = 0;
& & & & BOOL bOK = TRUE;
& & & & if &#40;m_hSocket == INVALID_SOCKET&#41;
& & & & & & & & return TRUE;
& & & & struct timeval timeout = &#123; 0, 0 &#125;;
& & & & fd_set readSocketSet;
& & & & FD_ZERO&#40;&readSocketSet&#41;;
& & & & FD_SET&#40;m_hSocket, &readSocketSet&#41;;
& & & & iRet = ::select&#40;0, &readSocketSet, NULL, NULL, &timeout&#41;;
& & & & bOK = &#40;iRet & 0&#41;;
& & & & if&#40;bOK&#41;
& & & & &#123;
& & & & & & & & bOK = FD_ISSET&#40;m_hSocket, &readSocketSet&#41;;
& & & & &#125;
& & & & if&#40;bOK&#41;
& & & & &#123;
& & & & & & & & CHAR szBuffer&#91;1&#93; = &&;
& & & & & & & & iRet = ::recv&#40;m_hSocket, szBuffer, 1, MSG_PEEK&#41;;
& & & & & & & & bOK = &#40;iRet & 0&#41;;
& & & & & & & & if&#40;!bOK&#41;
& & & & & & & & &#123;
& & & & & & & & & & & & INT iError = ::WSAGetLastError&#40;&#41;;
& & & & & & & & & & & & bConnDropped = &#40;&#40; iError == WSAENETRESET&#41; ||
& & & & & & & & & & & & & & & & &#40;iError == WSAECONNABORTED&#41; ||
& & & & & & & & & & & & & & & & &#40;iError == WSAECONNRESET&#41; ||
& & & & & & & & & & & & & & & & &#40;iError == WSAEINVAL&#41; ||
& & & & & & & & & & & & & & & & &#40;iRet == 0&#41;&#41;;
& & & & & & & & &#125;
& & & & &#125;
& & return&#40;bConnDropped&#41;;
/********************************************************************/
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* Function name: SendResponse& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */& & & & & & &
/* Description &: Send response to client.& & & & & & & & & & & & & & & & & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/********************************************************************/
BOOL CConnectSocket::SendResponse&#40;CString strData&#41;
& & & & // is connection still active ?
& & & & if &#40;HasConnectionDropped&#40;&#41;&#41;
& & & & &#123;
& & & & & & & & FireStatusMessage&#40;&could not send reply, disconnected.&, 2&#41;;& &
& & & & & & & & Close&#40;&#41;;
& & & & & & & & // tell our thread we have been closed
& & & & & & & &
& & & & & & & & // destroy connection
& & & & & & & & m_pThread-&PostThreadMessage&#40;WM_THREADMSG, 1, 0&#41;;
& & & & & & & & return FALSE;
& & & & &#125;
& & & & int nBytes = CSocket::Send&#40;strData + &\r\n&, strData.GetLength&#40;&#41;+2&#41;;
& & & & if &#40;nBytes == SOCKET_ERROR&#41;
& & & & &#123;
& & & & & & & & Close&#40;&#41;;
& & & & & & & & FireStatusMessage&#40;&could not send reply, disconnected.&, 2&#41;;& &
& & & & & & & & // tell our thread we have been closed
& & & & & & & & m_pThread-&PostThreadMessage&#40;WM_THREADMSG, 1, 0&#41;;
& & & & & & & & return FALSE;
& & & & &#125;
& & & & FireStatusMessage&#40;strData, 2&#41;;
& & & & &#40;&#40;CConnectThread *&#41;AfxGetThread&#40;&#41;&#41;-&IncSentBytes&#40;nBytes&#41;;
& & & & return TRUE;
/********************************************************************/
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* Function name: ParseCommand& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */& & & & & & &
/* Description &: Parse and execute command from client.& & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/********************************************************************/
void CConnectSocket::ParseCommand&#40;&#41;
& & & & static CFTPCommand commandList&#91;&#93; =
& & & & &#123;
& & & & & & & & &#123;TOK_USER,& & & &USER&, TRUE&#125;,
& & & & & & & & &#123;TOK_PASS,& & & &PASS&, TRUE&#125;,
& & & & & & & & &#123;TOK_CWD, & & & &CWD&,& TRUE&#125;,
& & & & & & & & &#123;TOK_PWD, & & & &PWD&,& FALSE&#125;,
& & & & & & & & &#123;TOK_PORT,& & & &PORT&, TRUE&#125;,
& & & & & & & & &#123;TOK_PASV,& & & &PASV&, FALSE&#125;,
& & & & & & & & &#123;TOK_TYPE,& & & &TYPE&, TRUE&#125;,
& & & & & & & & &#123;TOK_LIST,& & & &LIST&, FALSE&#125;,
& & & & & & & & &#123;TOK_REST,& & & &REST&, TRUE&#125;,
& & & & & & & & &#123;TOK_CDUP,& & & &CDUP&, FALSE&#125;,
& & & & & & & & &#123;TOK_RETR,& & & &RETR&, TRUE&#125;,
& & & & & & & & &#123;TOK_STOR,& & & &STOR&, TRUE&#125;,
& & & & & & & & &#123;TOK_SIZE,& & & &SIZE&, TRUE&#125;,
& & & & & & & & &#123;TOK_DELE,& & & &DELE&, TRUE&#125;,
& & & & & & & & &#123;TOK_RMD, & & & &RMD&,& TRUE&#125;,
& & & & & & & & &#123;TOK_MKD, & & & &MKD&,& TRUE&#125;,
& & & & & & & & &#123;TOK_RNFR,& & & &RNFR&, TRUE&#125;,
& & & & & & & & &#123;TOK_RNTO,& & & &RNTO&, TRUE&#125;,
& & & & & & & & &#123;TOK_ABOR,& & & &ABOR&, FALSE&#125;,
& & & & & & & & &#123;TOK_SYST,& & & &SYST&, FALSE&#125;,
& & & & & & & & &#123;TOK_NOOP,& & & &NOOP&, FALSE&#125;,
& & & & & & & & &#123;TOK_BYE, & & & &BYE&, &FALSE&#125;,
& & & & & & & & &#123;TOK_QUIT,& & & &QUIT&, &FALSE&#125;,
& & & & & & & & &#123;TOK_ERROR, & & &&, & & & & & & FALSE&#125;,
& & & & &#125;;
& & & & // parse command
& & & & CString strCommand, strArguments;
& & & & if &#40;!GetRxCommand&#40;strCommand, strArguments&#41;&#41;
& & & & &#123;
& & & & & & & & return;
& & & & &#125;
& & & & int nCommand;
& & & & // find command in command list
& & & & for &#40;nCommand = TOK_USER; nCommand & TOK_ERROR; nCommand++&#41;
& & & & &#123;
& & & & & & & & // found command ?
& & & & & & & & if &#40;strCommand == commandList&#91;nCommand&#93;.m_pszName&#41;
& & & & & & & & &#123;
& & & & & & & & & & & & // did we expect an argument ?
& & & & & & & & & & & & if &#40;commandList&#91;nCommand&#93;.m_bHasArguments && &#40;strArguments == &&&#41;&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & SendResponse&#40;&501 Syntax error&&#41;;
& & & & & & & & & & & & & & & & return;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & break;& & & & & & & & &
& & & & & & & & &#125;
& & & & &#125;
& & & & if &#40;nCommand == TOK_ERROR&#41;
& & & & &#123;
& & & & & & & & // command is not in our list
& & & & & & & & SendResponse&#40;&500 Syntax error, command unrecognized.&&#41;;
& & & & & & & & return;
& & & & &#125;
& & & & // no commands are excepted before successfull logged on
& & & & if &#40;nCommand & TOK_PASS && !m_bLoggedon&#41;
& & & & &#123;
& & & & & & & & SendResponse&#40;&530 Please log in with USER and PASS first.&&#41;;
& & & & & & & & return;
& & & & &#125;
& & & & // proces command
& & & & switch&#40;nCommand&#41;
& & & & &#123;
& & & & & & & & // specify username
& & & & & & & & case TOK_USER:
& & & & & & & & &#123;
& & & & & & & & & & & & strArguments.MakeLower&#40;&#41;;
& & & & & & & & & & & & m_bLoggedon = FALSE;
& & & & & & & & & & & & m_strUserName = strArguments;
& & & & & & & & & & & & CString strPeerAddress;
& & & & & & & & & & & & UINT nPeerPort;
& & & & & & & & & & & & GetPeerName&#40;strPeerAddress, nPeerPort&#41;;
& & & & & & & & & & & & // tell FTP server a new user has connected
& & & & & & & & & & & & CConnectThread *pThread = &#40;CConnectThread *&#41;m_pThread;
& & & & & & & & & & & & &#40;&#40;CFTPServer *&#41;pThread-&m_pWndServer&#41;-&m_pEventSink-&OnFTPUserConnected&#40;m_pThread-&m_nThreadID, m_strUserName, strPeerAddress&#41;;
& & & & & & & & & & & & SendResponse&#40;&331 Password required for & + strArguments&#41;;
& & & & & & & & &#125;
& & & & & & & & break;
& & & & & & & & // specify password
& & & & & & & & case TOK_PASS:
& & & & & & & & &#123;
& & & & & & & & & & & & // already logged on ?
& & & & & & & & & & & & if &#40;m_bLoggedon&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & SendResponse&#40;&503 Bad sequence of commands.&&#41;;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & else
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & // check user and password
& & & & & & & & & & & & & & & & CUser user;
& & & & & & & & & & & & & & & & if &#40;theServer.m_UserManager.CheckUser&#40;m_strUserName, strArguments, user&#41;&#41;
& & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & // set home directory of user
& & & & & & & & & & & & & & & & & & & & m_strCurrentDir = &/&;
& & & & & & & & & & & & & & & & & & & & // succesfully logged on
& & & & & & & & & & & & & & & & & & & & m_bLoggedon = TRUE;
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&230 Logged on&&#41;;
& & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & else
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&530 Login or password incorrect!&&#41;;
& & & & & & & & & & & & &#125;
& & & & & & & & &#125;
& & & & & & & & break;
& & & & & & & &
& & & & & & & & // change current directory
& & & & & & & & case TOK_CWD:
& & & & & & & & &#123;
& & & & & & & & & & & & int nResult = theServer.m_UserManager.ChangeDirectory&#40;m_strUserName, m_strCurrentDir, strArguments&#41;;
& & & & & & & & & & & &
& & & & & & & & & & & & CString str;
& & & & & & & & & & & & switch&#40;nResult&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & case 0:
& & & & & & & & & & & & & & & & & & & & str.Format&#40;&250 CWD successful. \&%s\& is current directory.&, m_strCurrentDir&#41;;
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;str&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & case 1:
& & & & & & & & & & & & & & & & & & & & str.Format&#40;&550 CWD failed. \&%s\&: Permission denied.&, strArguments&#41;;
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;str&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & default:
& & & & & & & & & & & & & & & & & & & & str.Format&#40;&550 CWD failed. \&%s\&: directory not found.&, strArguments&#41;;
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;str&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & &#125;
& & & & & & & & &#125;
& & & & & & & & break;
& & & & & & & & // print current directory
& & & & & & & & case TOK_PWD:
& & & & & & & & &#123;
& & & & & & & & & & & & CString str;
& & & & & & & & & & & & str.Format&#40;&257 \&%s\& is current directory.&, m_strCurrentDir&#41;;
& & & & & & & & & & & & SendResponse&#40;str&#41;;& & &
& & & & & & & & &#125;
& & & & & & & & break;
& & & & & & & & // specify IP and port (PORT a1,a2,a3,a4,p1,p2) -& IP address a1.a2.a3.a4, port p1*256+p2.
& & & & & & & & case TOK_PORT:
& & & & & & & & &#123;
& & & & & & & & & & & & CString strSub;
& & & & & & & & & & & & int nCount=0;
& & & & & & & & & & & & while &#40;AfxExtractSubString&#40;strSub, strArguments, nCount++, ','&#41;&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & switch&#40;nCount&#41;
& & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & case 1: // a1
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_strRemoteHost = strSub;
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_strRemoteHost += &.&;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & case 2: // a2
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_strRemoteHost += strSub;
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_strRemoteHost += &.&;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & case 3: // a3
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_strRemoteHost += strSub;
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_strRemoteHost += &.&;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & case 4: // a4
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_strRemoteHost += strSub;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & case 5: // p1
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_nRemotePort = <span style="color: #*atoi&#40;strSub&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & case 6: // p2
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_nRemotePort += atoi&#40;strSub&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & m_TransferStatus.m_bPassiveMode = FALSE;
& & & & & & & & & & & & SendResponse&#40;&200 Port command successful&&#41;;
& & & & & & & & & & & & break;
& & & & & & & & &#125;
& & & & & & & &
& & & & & & & & // switch to passive mode
& & & & & & & & case TOK_PASV:
& & & & & & & & &#123;
& & & & & & & & & & & & // delete existing datasocket
& & & & & & & & & & & & DestroyDataSocket&#40;&#41;;
& & & & & & & & & & & & // create new data socket
& & & & & & & & & & & & m_TransferStatus.m_pDataSocket = new CDataSocket&#40;this, -1&#41;;
& & & & & & & & & & & & if &#40;!m_TransferStatus.m_pDataSocket-&Create&#40;&#41;&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & DestroyDataSocket&#40;&#41;;& & & & & & & & & & & & & &
& & & & & & & & & & & & & & & & SendResponse&#40;&421 Can't create socket&&#41;;
& & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & // start listening
& & & & & & & & & & & & m_TransferStatus.m_pDataSocket-&Listen&#40;&#41;;
& & & & & & & & & & & & m_TransferStatus.m_pDataSocket-&AsyncSelect&#40;&#41;;
& & & & & & & & & & & &
& & & & & & & & & & & & CString strIP, strTmp;
& & & & & & & & & & & & UINT nPort;
& & & & & & & & & & & &
& & & & & & & & & & & & // get our ip address
& & & & & & & & & & & & GetSockName&#40;strIP, nPort&#41;;
& & & & & & & & & & & & // Now retrieve the port
& & & & & & & & & & & & m_TransferStatus.m_pDataSocket-&GetSockName&#40;strTmp, nPort&#41;;
& & & & & & & & & & & & // Reformat the ip
& & & & & & & & & & & & strIP.Replace&#40;&.&,&,&&#41;;
& & & & & & & & & & & & // tell the client which address/port to connect to
& & & & & & & & & & & & CString str;
& & & & & & & & & & & & str.Format&#40;&227 Entering Passive Mode (%s,%d,%d)&, strIP, nPort/<span style="color: #, nPort%256&#41;;
& & & & & & & & & & & & SendResponse&#40;str&#41;;
& & & & & & & & & & & & m_TransferStatus.m_bPassiveMode = TRUE;
& & & & & & & & & & & & break;
& & & & & & & & &#125;
& & & & & & & & case TOK_TYPE:
& & & & & & & & &#123;
& & & & & & & & & & & & SendResponse&#40;&200 Type set to & + strArguments&#41;;
& & & & & & & & &#125;
& & & & & & & & break;
& & & & & & & & // list current directory
& & & & & & & & case TOK_LIST:
& & & & & & & & &#123;
& & & & & & & & & & & & if&#40;!m_TransferStatus.m_bPassiveMode && &#40;m_TransferStatus.m_strRemoteHost == && || m_TransferStatus.m_nRemotePort == -1&#41;&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & SendResponse&#40;&503 Bad sequence of commands.&&#41;;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & else
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & // if client did not specify a directory use current dir
& & & & & & & & & & & & & & & & if &#40;strArguments == &&&#41;
& & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & strArguments = m_strCurrentDir;
& & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & else
& & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & // check if argument is file or directory
& & & & & & & & & & & & & & & & & & & & CString strResult;
& & & & & & & & & & & & & & & & & & & & int nResult = theServer.m_UserManager.GetFileName&#40;m_strUserName, strArguments, m_strCurrentDir, FTP_LIST, strResult&#41;;
& & & & & & & & & & & & & & & & & & & & if &#40;nResult == 0&#41;
& & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & strArguments = strResult;
& & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & CString strListing;
& & & & & & & & & & & & & & & & int nResult = theServer.m_UserManager.GetDirectoryList&#40;m_strUserName, strArguments, strListing&#41;;
& & & & & & & & & & & & & & & & switch&#40;nResult&#41;
& & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & case 1:
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Permission denied&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & case 2:
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Directory not found&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & default:
& & & & & & & & & & & & & & & & & & & & & & & & if &#40;!m_TransferStatus.m_bPassiveMode&#41;
& & & & & & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & CDataSocket *pDataSocket = new CDataSocket&#40;this, 0&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & pDataSocket-&Create&#40;&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & pDataSocket-&SetData&#40;strListing&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & pDataSocket-&AsyncSelect&#40;&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_pDataSocket = pDataSocket;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & if &#40;!pDataSocket-&Connect&#40;m_TransferStatus.m_strRemoteHost, m_TransferStatus.m_nRemotePort&#41;&#41;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & if &#40;GetLastError&#40;&#41; != WSAEWOULDBLOCK&#41;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&425 Can't open data connection&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&150 Opening data channel for directory list.&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & & & & & else
& & & & & & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_pDataSocket-&SetData&#40;strListing&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_pDataSocket-&SetTransferType&#40;0&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & break;
& & & & & & & & &#125;
& & & & & & & & // change to parent directory
& & & & & & & & case TOK_CDUP:
& & & & & & & & &#123;
& & & & & & & & & & & & CString strDirectory = &..&;
& & & & & & & & & & & & CString str;
& & & & & & & & & & & & int nResult = theServer.m_UserManager.ChangeDirectory&#40;m_strUserName, m_strCurrentDir, strDirectory&#41;;
& & & & & & & & & & & & switch&#40;nResult&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & case 0:
& & & & & & & & & & & & & & & & & & & & str.Format&#40;&250 CWD successful. \&%s\& is current directory.&, m_strCurrentDir&#41;;
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;str&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & case 1:
& & & & & & & & & & & & & & & & & & & & str.Format&#40;&550 CWD failed. \&%s\&: Permission denied.&, strDirectory&#41;;
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;str&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & case 2:
& & & & & & & & & & & & & & & & & & & & str.Format&#40;&550 CWD failed. \&%s\&: directory not found.&, strDirectory&#41;;
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;str&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & &#125;
& & & & & & & & &#125;
& & & & & & & & break;
& & & & & & & & // retrieve file
& & & & & & & & case TOK_RETR:
& & & & & & & & &#123;
& & & & & & & & & & & & if&#40;!m_TransferStatus.m_bPassiveMode && &#40;m_TransferStatus.m_strRemoteHost == && || m_TransferStatus.m_nRemotePort == -1&#41;&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & SendResponse&#40;&503 Bad sequence of commands.&&#41;;
& & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & &
& & & & & & & & & & & & CString strResult;
& & & & & & & & & & & & int nResult = theServer.m_UserManager.GetFileName&#40;m_strUserName, strArguments, m_strCurrentDir, FTP_DOWNLOAD, strResult&#41;;
& & & & & & & & & & & & switch&#40;nResult&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & case 1:
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Permission denied&&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & case 2:
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 File not found&&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & default:
& & & & & & & & & & & & & & & & & & & & if &#40;!m_TransferStatus.m_bPassiveMode&#41;
& & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & CDataSocket *pDataSocket = new CDataSocket&#40;this, 1&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_pDataSocket = pDataSocket;
& & & & & & & & & & & & & & & & & & & & & & & & pDataSocket-&Create&#40;&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & pDataSocket-&AsyncSelect&#40;&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & pDataSocket-&SetData&#40;strResult&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & if &#40;pDataSocket-&Connect&#40;m_TransferStatus.m_strRemoteHost ,m_TransferStatus.m_nRemotePort&#41; == 0&#41;
& & & & & & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & if &#40;GetLastError&#40;&#41; != WSAEWOULDBLOCK&#41;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&425 Can't open data connection&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&150 Opening data channel for file transfer.&&#41;;
& & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & else
& & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_pDataSocket-&SetData&#40;strResult&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_pDataSocket-&SetTransferType&#40;1&#41;;
& & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & break;&
& & & & & & & & &#125;
& & & & & & & & // client wants to upload file
& & & & & & & & case TOK_STOR:
& & & & & & & & &#123;
& & & & & & & & & & & & if&#40;m_TransferStatus.m_bPassiveMode == -1&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & SendResponse&#40;&503 Bad sequence of commands.&&#41;;
& & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & if&#40;!m_TransferStatus.m_bPassiveMode && &#40;m_TransferStatus.m_strRemoteHost == && || m_TransferStatus.m_nRemotePort == -1&#41;&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & SendResponse&#40;&503 Bad sequence of commands.&&#41;;
& & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & &
& & & & & & & & & & & & CString strResult;
& & & & & & & & & & & & int nResult = theServer.m_UserManager.GetFileName&#40;m_strUserName, strArguments, m_strCurrentDir, FTP_UPLOAD, strResult&#41;;
& & & & & & & & & & & & switch&#40;nResult&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & case 1:
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Permission denied&&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & case 2:
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Filename invalid&&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & default:
& & & & & & & & & & & & & & & & & & & & if &#40;!m_TransferStatus.m_bPassiveMode&#41;
& & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & CDataSocket *pDataSocket = new CDataSocket&#40;this, 2&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_pDataSocket = pDataSocket;
& & & & & & & & & & & & & & & & & & & & & & & & pDataSocket-&Create&#40;&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & pDataSocket-&AsyncSelect&#40;&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & pDataSocket-&SetData&#40;strResult&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & if &#40;pDataSocket-&Connect&#40;m_TransferStatus.m_strRemoteHost, m_TransferStatus.m_nRemotePort&#41; == 0&#41;
& & & & & & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & if &#40;GetLastError&#40;&#41; != WSAEWOULDBLOCK&#41;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&425 Can't open data connection&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&150 Opening data channel for file transfer.&&#41;;
& & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & else
& & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_pDataSocket-&SetData&#40;strResult&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & m_TransferStatus.m_pDataSocket-&SetTransferType&#40;2&#41;;
& & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & &#125;
& & & & & & & & &#125;
& & & & & & & & break;
& & & & & & & &
& & & & & & & & // get file size
& & & & & & & & case TOK_SIZE:
& & & & & & & & &#123;
& & & & & & & & & & & & CString strResult;
& & & & & & & & & & & & int nResult = theServer.m_UserManager.GetFileName&#40;m_strUserName, strArguments, m_strCurrentDir, FTP_DOWNLOAD, strResult&#41;;
& & & & & & & & & & & & switch&#40;nResult&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & case 1:
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Permission denied&&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & case 2:
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 File not found&&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & default:
& & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & CFileStatus status;
& & & & & & & & & & & & & & & & & & & & CFile::GetStatus&#40;strResult, status&#41;;
& & & & & & & & & & & & & & & & & & & & CString strResponse;
& & & & & & & & & & & & & & & & & & & & strResponse.Format&#40;&213 %d&, status.m_size&#41;;
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;strResponse&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & &#125;
& & & & & & & & &#125;
& & & & & & & & break;
& & & & & & & &
& & & & & & & & // delete file
& & & & & & & & case TOK_DELE:
& & & & & & & & &#123;
& & & & & & & & & & & & CString strResult;
& & & & & & & & & & & & int nResult = theServer.m_UserManager.GetFileName&#40;m_strUserName, strArguments, m_strCurrentDir, FTP_DELETE, strResult&#41;;
& & & & & & & & & & & & switch&#40;nResult&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & case 1:
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Permission denied&&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & case 2:
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 File not found&&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & default:
& & & & & & & & & & & & & & & & & & & & try
& & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & CFile::Remove&#40;strResult&#41;;
& & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & catch&#40;CFileException *e&#41;
& & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & e-&Delete&#40;&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&450 Internal error deleting the file.&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&250 File deleted successfully&&#41;;& & & & & & & & &
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & &#125;
& & & & & & & & &#125;
& & & & & & & & break;
& & & & & & & &
& & & & & & & & // remove directory
& & & & & & & & case TOK_RMD:
& & & & & & & & &#123;
& & & & & & & & & & & & CString strResult;
& & & & & & & & & & & & int nResult = theServer.m_UserManager.GetDirectory&#40;m_strUserName, strArguments, m_strCurrentDir, FTP_DELETE, strResult&#41;;
& & & & & & & & & & & & switch&#40;nResult&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & case 1:
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Permission denied&&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & case 2:
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Directory not found&&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & default:
& & & & & & & & & & & & & & & & & & & & if &#40;!RemoveDirectory&#40;strResult&#41;&#41;
& & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & if &#40;GetLastError&#40;&#41; == ERROR_DIR_NOT_EMPTY&#41;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Directory not empty.&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & else
& & & & & & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&450 Internal error deleting the directory.&&#41;;
& & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & else
& & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&250 Directory deleted successfully&&#41;;
& & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & &#125;
& & & & & & & & &#125;
& & & & & & & & break;&
& & & & & & & &
& & & & & & & & // create directory
& & & & & & & & case TOK_MKD:
& & & & & & & & &#123;
& & & & & & & & & & & & CString strResult;
& & & & & & & & & & & & int nResult = theServer.m_UserManager.GetDirectory&#40;m_strUserName, strArguments, m_strCurrentDir, FTP_CREATE_DIR, strResult&#41;;
& & & & & & & & & & & & switch&#40;nResult&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & case 0:
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Directory already exists&&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & case 1:
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Can't create directory. Permission denied&&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & case 3:
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Directoryname not valid&&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & default:
& & & & & & & & & & & & & & & & & & & & strResult += &\\&;
& & & & & & & & & & & & & & & & & & & & CString strDir;
& & & & & & & & & & & & & & & & & & & & BOOL bResult;
& & & & & & & & & & & & & & & & & & & & // create directory structure one part at a time
& & & & & & & & & & & & & & & & & & & & while &#40;strResult != &&&#41;
& & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & strDir += strResult.Left&#40;strResult.Find&#40;&\\&&#41;+1&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & strResult = strResult.Mid&#40;strResult.Find&#40;&\\&&#41;+1&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & bResult = CreateDirectory&#40;strDir, 0&#41;;
& & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & if &#40;!bResult&#41;
& & & & & & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&450 Internal error creating the directory.&&#41;;
& & & & & & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & & & & & & & & & else
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&250 Directory created successfully&&#41;;
& & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & &#125;
& & & & & & & & &#125;
& & & & & & & & break;
& & & & & & & &
& & & & & & & & // rename file or directory (part 1)
& & & & & & & & case TOK_RNFR:
& & & & & & & & &#123;
& & & & & & & & & & & & CString strResult;
& & & & & & & & & & & & int nResult = theServer.m_UserManager.GetFileName&#40;m_strUserName, strArguments, m_strCurrentDir, FTP_RENAME, strResult&#41;;
& & & & & & & & & & & & if &#40;nResult == 0&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & m_strRenameFile = strResult;
& & & & & & & & & & & & & & & & m_bRenameFile = TRUE;
& & & & & & & & & & & & & & & & SendResponse&#40;&350 File exists, ready for destination name.&&#41;;
& & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & else
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & // client wants to rename directory
& & & & & & & & & & & & & & & & nResult = theServer.m_UserManager.GetDirectory&#40;m_strUserName, strArguments, m_strCurrentDir, FTP_RENAME, strResult&#41;;
& & & & & & & & & & & & & & & & switch&#40;nResult&#41;
& & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & case 0:
& & & & & & & & & & & & & & & & & & & & & & & & m_strRenameFile = strResult;
& & & & & & & & & & & & & & & & & & & & & & & & m_bRenameFile = FALSE;
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&350 Directory exists, ready for destination name.&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & case 1:
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Permission denied&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & default:
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 file/directory not found&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & &#125; & & &
& & & & & & & & &#125;
& & & & & & & & break;
& & & & & & & & // rename file or directory (part 2)
& & & & & & & & case TOK_RNTO:
& & & & & & & & &#123;
& & & & & & & & & & & & if &#40;m_strRenameFile.IsEmpty&#40;&#41;&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & SendResponse&#40;&503 Bad sequence of commands!&&#41;;
& & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & if &#40;m_bRenameFile&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & CString strResult;
& & & & & & & & & & & & & & & & // check destination filename
& & & & & & & & & & & & & & & & int nResult = theServer.m_UserManager.GetFileName&#40;m_strUserName, strArguments, m_strCurrentDir, FTP_RENAME, strResult&#41;;
& & & & & & & & & & & & & & & & switch&#40;nResult&#41;
& & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & case 0:
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 file exists&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & case 1:
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Permission denied&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & default:
& & & & & & & & & & & & & & & & & & & & & & & & if &#40;!MoveFile&#40;m_strRenameFile, strResult&#41;&#41;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&450 Internal error renaming the file&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & else
& & & & & & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&250 file renamed successfully&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & else
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & CString strResult;
& & & & & & & & & & & & & & & & // check destination directory name
& & & & & & & & & & & & & & & & int nResult = theServer.m_UserManager.GetDirectory&#40;m_strUserName, strArguments, m_strCurrentDir, FTP_RENAME, strResult&#41;;
& & & & & & & & & & & & & & & & switch&#40;nResult&#41;
& & & & & & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & & & & & case 0:
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 directory exists&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & case 1:
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Permission denied&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & case 3:
& & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&550 Filename invalid&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & & & & & default:
& & & & & & & & & & & & & & & & & & & & & & & & if &#40;!MoveFile&#40;m_strRenameFile, strResult&#41;&#41;
& & & & & & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&450 Internal error renaming the file&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & else
& & & & & & & & & & & & & & & & & & & & & & & & & & & & SendResponse&#40;&250 file renamed successfully&&#41;;
& & & & & & & & & & & & & & & & & & & & & & & & break;
& & & & & & & & & & & & & & & & &#125;
& & & & & & & & & & & & &#125; & & & & & & &
& & & & & & & & &#125;
& & & & & & & & break;
& & & & & & & & // abort transfer
& & & & & & & & case TOK_ABOR:
& & & & & & & & &#123;
& & & & & & & & & & & & if &#40;m_TransferStatus.m_pDataSocket&#41;
& & & & & & & & & & & & &#123;
& & & & & & & & & & & & & & & & if &#40;m_TransferStatus.m_pDataSocket-&GetStatus&#40;&#41; != XFERMODE_IDLE&#41;
& & & & & & & & & & & & & & & & & & & & SendResponse&#40;&426 C transfer aborted.&&#41;;
& & & & & & & & & & & & & & & & // destroy data socket
& & & & & & & & & & & & & & & & m_pThread-&PostThreadMessage&#40;WM_THREADMSG, 0, 0&#41;;
//& & & & & & & & & & & & & & & DestroyDataSocket();
& & & & & & & & & & & & &#125;
& & & & & & & & & & & & SendResponse&#40;&226 ABOR command successful&&#41;;
& & & & & & & & & & & & break;
& & & & & & & & &#125;
& & & & & & & & // get system info
& & & & & & & & case TOK_SYST:
& & & & & & & & & & & & SendResponse&#40;&215 UNIX emulated by Pablo's FTP Server&&#41;;
& & & & & & & & & & & & break;
& & & & & & & &
& & & & & & & & // close connection
& & & & & & & & case TOK_BYE:
& & & & & & & & case TOK_QUIT:
& & & & & & & & &#123;
& & & & & & & & & & & & // send goodbye message to client
& & & & & & & & & & & & CConnectThread *pThread = &#40;CConnectThread *&#41;m_pThread;
& & & & & & & & & & & & CString strText = &#40;&#40;CFTPServer *&#41;pThread-&m_pWndServer&#41;-&GetGoodbyeMessage&#40;&#41;;
& & & & & & & & & & & & SendResponse&#40;&220 & + strText&#41;;
& & & & & & & & & & & & Close&#40;&#41;;
& & & & & & & & & & & &
& & & & & & & & & & & & // tell our thread we have been closed
& & & & & & & &
& & & & & & & & & & & & // destroy connection
& & & & & & & & & & & & m_pThread-&PostThreadMessage&#40;WM_THREADMSG, 1, 0&#41;;
& & & & & & & & & & & & break;
& & & & & & & & &#125;
& & & & & & & & // dummy instruction
& & & & & & & & case TOK_NOOP:
& & & & & & & & & & & & SendResponse&#40;&200 OK&&#41;;
& & & & & & & & & & & & break;
& & & & & & & & default:
& & & & & & & & & & & & SendResponse&#40;&502 Command not implemented.&&#41;;
& & & & & & & & & & & & break;
& & & & &#125;
/********************************************************************/
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* Function name: FireStatusMessage & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */& & & & & & &
/* Description &: Fire status message.& & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/********************************************************************/
void CConnectSocket::FireStatusMessage&#40;LPCTSTR lpszStatus, int nType&#41;
& & & & CConnectThread *pThread = &#40;CConnectThread *&#41;m_pThread;
& & & & &#40;&#40;CFTPServer *&#41;pThread-&m_pWndServer&#41;-&AddTraceLine&#40;nType, &[%d] %s&, m_pThread-&m_nThreadID, lpszStatus&#41;;
/********************************************************************/
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/* Function name: DestroyDataSocket & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */& & & & & & &
/* Description &: Close data transfer socket. & & & & & & & & & & & & & & & & & & & & & */
/*& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & */
/********************************************************************/
void CConnectSocket::DestroyDataSocket&#40;&#41;
& & & & if &#40;!m_TransferStatus.m_pDataSocket&#41;
& & & & & & & & return;
//& & & m_TransferStatus.m_pDataSocket-&Close();
& & & & delete m_TransferStatus.m_pDataSocket;
& & & & // reset transfer status
& & & & m_TransferStatus.m_pDataSocket = NULL;
& & & & m_TransferStatus.m_strRemoteHost = &&;
& & & & m_TransferStatus.m_nRemotePort = -1;
& & & & m_TransferStatus.m_bPassiveMode = FALSE;
& & & & m_TransferStatus.m_nRest = -1;
char *CConnectSocket::GetResponseMessage&#40;int nResponse&#41;
& & & & switch&#40;nResponse&#41;
& & & & &#123;
& & & & & & & & case <span style="color: # : return &Restart marker reply&; break;
& & & & & & & & case <span style="color: # : return &Service ready in nnn minutes.&; break;
& & & & & & & & case <span style="color: # : return &Data con transfer starting.&; break;
& & & & & & & & case <span style="color: # : return &F about to open data connection.&; break;
& & & & & & & & case <span style="color: # : return &Command okay.&; break;
& & & & & & & & case <span style="color: # : return &Command not implemented, superfluous at this site.&; break;
& & & & & & & & case <span style="color: # : return &System status, or system help reply.&; break;
& & & & & & & & case <span style="color: # : return &Directory status.&; break;
& & & & & & & & case <span style="color: # : return &File status.&; break;
& & & & & & & & case <span style="color: # : return &Help message.&; break;
& & & & & & & & case <span style="color: # : return &NAME system type.&; break;
& & & & & & & & case <span style="color: # : return &Service ready for new user.&; break;
& & & & & & & & case <span style="color: # : return &Service closing control connection.&; break;
& & & & & & & & case <span style="color: # : return &D no transfer in progress.&; break;
& & & & & & & & case <span style="color: # : return &Closing data connection successfully.&; break;
& & & & & & & & case <span style="color: # : return &Entering Passive Mode (h1,h2,h3,h4,p1,p2).&; break;
& & & & & & & & case <span style="color: # : return &User logged in, proceed.&; break;
& & & & & & & & case <span style="color: # : return &Requested file action okay, completed.&; break;
& & & & & & & & case <span style="color: # : return &PATHNAME created.&; break;
& & & & & & & & case <span style="color: # : return &User name okay, need password.&; break;
& & & & & & & & case <span style="color: # : return &Need account for login.&; break;
& & & & & & & & case <span style="color: # : return &Requested file action pending further information.&; break;
& & & & & & & & case <span style="color: # : return &Service not available, closing control connection.&; break;
& & & & & & & & case <span style="color: # : return &Can't open data connection.&; break;
& & & & & & & & case <span style="color: # : return &C transfer aborted.&; break;
& & & & & & & & case <span style="color: # : return &Requested file action not taken - File unavailable.&; break;
& & & & & & & & case <span style="color: # : return &Requested action aborted: local error in processing.&; break;
& & & & & & & & case <span style="color: # : return &Requested action not taken - Insufficient storage space in system.&; break;
& & & & & & & & case <span style="color: # : return &Syntax error, command unrecognized.&; break;
& & & & & & & & case <span style="color: # : return &Syntax error in parameters or arguments.&; break;
& & & & & & & & case <span style="color: # : return &Command not implemented.&; break;
& & & & & & & & case <span style="color: # : return &Bad sequence of commands.&; break;
& & & & & & & & case <span style="color: # : return &Command not implemented for that parameter.&; break;
& & & & & & & & case <span style="color: # : return &Not logged in.&; break;
& & & & & & & & case <span style="color: # : return &Need account for storing files.&; break;
& & & & & & & & case <span style="color: # : return &Requested action not taken - File unavailable.&; break;
& & & & & & & & case <span style="color: # : return &Requested action aborted: page type unknown.&; break;
& & & & & & & & case <span style="color: # : return &Requested file action aborted - Exceeded storage allocation&; break;
& & & & & & & & case <span style="color: # : return &Requested action not taken - File name not allowed.&; break;
& & & & & & & & default &: return &Unknown error&;
& & & & &#125;
void CConnectSocket::Shutdown&#40;int nReason&#41;
& & & & DestroyDataSocket&#40;&#41;;
& & & & switch&#40;nReason&#41;
& & & & &#123;
& & & & & & & & case 1:
& & & & & & & & & & & & SendResponse&#40;&421 Connection timed out.&&#41;;
& & & & & & & & & & & & break;
& & & & & & & & case 2:
& & & & & & & & & & & & SendResponse&#40;&421 No-transfer-time exceeded. Closing control connection.&&#41;;
& & & & & & & & & & & & break;
& & & & & & & & case 3:
& & & & & & & & & & & & SendResponse&#40;&421 Login time exceeded. Closing control connection.&&#41;;
& & & & & & & & & & & & break;
& & & & & & & & case 4:
& & & & & & & & & & & & SendResponse&#40;&421 Kicked by Administrator&&#41;;
& & & & & & & & & & & & break;
& & & & & & & & case 5:
& & & & & & & & & & & & SendResponse&#40;&421 Problem with server&&#41;;
& & & & & & & & & & & & break;
& & & & & & & & default:
& & & & & & & & & & & & SendResponse&#40;&421 Server is going offline&&#41;;
& & & & & & & & & & & & break;
& & & & &#125;
& & & & FireStatusMessage&#40;&disconnected.&, 0&#41;;&
& & & & Close&#40;&#41;;
& & & & // tell our thread we have been closed
//& & & m_pThread-&PostThreadMessage(WM_QUIT,0,0);
- 下载整个
相关源码/软件:
- C#编程实现获取硬盘序列号、名称等信息,获取后通过Winform显示出来,程序简单,为初学者提供参考...
- C# 仿Office2003风格菜单控件源码,附带了测试演示程序,来自老外网站,界面语言英文,组件效...
- 百变桌面大部分编程朋友应该都知道,它是一款循环更换桌面的小软件,这是v1.0的C#版源代码,重新编译...
- 继承和多态的相关Java源码下载,比较散,像覆盖和重载、对象类Object和它的toString()...
- 收集的一些Java高级编程实例源码,简要说明一下这些实例:文本计数、线程计数、读取控制台字符串、服务...
- VC.NET开发的简单又高效的日志管理系统,严格来说是一个日志写入模块,实现日志信息的批量写入件、定...
- 连连看游戏相信大家都知道吧,一个休闲益智游戏,用VC++写的连连看游戏也不错哦,虽然功能没那么强大,...
- 用C写的小型Blog系统,神奇吧?用C怎么能写Blog系统呢?
  作者既不会JSP,...
- VC++中的RAS加密、解密算法示例,实现基本的思路,生成控制台窗口,方便你查看运行结果。程序功能较...
- VC++推箱子游戏程序源代码,另附有一个地图编辑器,看上去还不错,资料比较全,学习编写游戏的朋友可以...
- 这是好玩的VC小游戏!~!~开发有限,如有什么错误,请多多谅解~!~!~!
- 本游戏实现了一个实时、多人、分布式坦克对战游戏。游戏的主要特征包括:&游戏运行于Win32...
- VC制作PDF417,Qr_Code,DataMatrix二维条码编码,源程序演示,有完整的详细接口...
- RFID超高频900MHZ读写程序V2.3,注释清楚,功能齐全,VS2008编译即可运行。实际使用程...
- 非常值得参考学习的输入法
- 最整洁的DX文件,结构清晰,适合初学DX的朋友学习扩展
- 能识别较小图片里的车牌
- 客户管理系统&Alfresco&Content&Management&...
- 暂时没有该资源介绍
- etbeans开发

我要回帖

更多关于 mac ftp客户端 的文章

 

随机推荐