|
|
Comments and Discussions
|
|
 |

|
I found that its function can be realized ,so I recommend
|
|
|
|

|
I have a small doubt in pasv command. My local system is connected to net using a broadband modem where it is connected via a router. If i want to connect to my ftp server from out side over net i need to use my external ip and its working fine getting connected, but it works only till executing the pasv command and no file list is displayed, my doubt is when responding for the pasv command i can send only my internal ip and a new connection to view the file list is not getting connected.
Below is the sample code. Actually this is working fine few months back, recently i had changed most of the parts and i dont know what happend to this.
// Here ClientSocket is the existing socket connection with the client
// Port is the temporary port for passiv mode
string EndPoint = ClientSocket.LocalEndPoint.ToString();
EndPoint = EndPoint.Substring(0, EndPoint.IndexOf(":"));
EndPoint = EndPoint.Replace(".", ",") + "," + (Port >> 8) + "," + (Port & 255);
Obtaining an external ip and sending it in in pasv response may work fine, but it was not an actual solution as the same code was working before few months back. Can you please help me out to solve this porblem. I am working on my college project with this and i need it as soon as possible. Thank you...
|
|
|
|

|
I am wondering what the following means in the overall scope of the program that the code is doing ? I am new to Visual C++ (MFC) and needed help understanding what this doing.
BOOL CFTPServer::Start()
{
// create dummy window for message routing
if (!CWnd::CreateEx(0, AfxRegisterWndClass(0), "FTP Server Notification Sink", WS_POPUP, 0,0,0,0, NULL, 0))
{
.......
......
}
|
|
|
|

|
Hi
Thanks for your greate job first.
I have a question about stor command.
When control socket recive a "stor" command,control socket calls CreateDataConnection to connect to client and then prepare to recive the file.
If OnConnect be called just after connect. And client sends file at once, control socket have no time to
call RetrieveFile and PrepareReceiveFile won't be called. So File cannot be recviced correctly.
What's your opinion?
Thanks
|
|
|
|

|
I am unable to get the server address for the ftp server which is installed in my pc. kindly tel me how to logon to the server.
As per my understanding ftp://username@ftpaddress
|
|
|
|

|
Not is possible convert this application to a library/component for use with another applications (compiling something like an OCX,DLL,TLB) ?
Mauricio Cunha
www.mcunha98.cjb.net
mcunha98@terra.com.br
|
|
|
|

|
Hi Pablo,
I have recently been looking into making my own FTP server. So I downloaded from CodeProject your FTP Server written in C++/MFC. It works really well, and it was very useful, however I thought I would point out that I believe that there is a bug in that version. If you push too many files, or even just a single large file it will stop uploading at 1064960 bytes, and (most clients, I use Filezilla... as I am an opensource fan) will ask you if you would like to overnight the file even if you haven't finished uploading it. I have been looking at your code, and I cannot see the reason for this
I thought I would bring this to your attention. You might have already fixed this error in later versions which I noticed you have created from your website, e.g the Baby FTP Server and the QuickNEasy one. May I know how to fix this bug?
Thank you for your help,
Best regards,
|
|
|
|

|
Pablo,
Did you ever make the C++ .NET code available for download?
Great work BTW!
-Jake
|
|
|
|

|
How can I get c# source code?
THT
|
|
|
|
|

|
I have compiled it into a 64bit app, but it cannot run!
|
|
|
|

|
if user gives URL like ftp:// then FTP server will show the folder structure, i want to capture this link in any method or program, how i do it??
Thxn in Advance
asdfasdfasdfasdf
|
|
|
|
|

|
neither this FTP server, nor Baby FTP are not supports files greater than 4Gb
i've fixed it by simple using I64 modificator in format string in CControlSocket::GetDirectoryList [ strLength.Format("%I64d", find.GetLength()); ] and using of ULONGLONG as type for CDataSocket::m_nTotal* variables
|
|
|
|
|

|
can anyone give me the approach to download a file from a ftp server using multithreding. (i.e. separate threads for downloading simultaneously USING JAVA)
VIVEK
|
|
|
|

|
Hi !,
I found this article is interesting and wanted to use the source in my project.
I have to develop a FTP server with minimum functionality (uploading and downloding the files).
Please let me know if I use the source is there any licensing problems ?
An early reply appriciated.
Thanks
Viswanatha Shastry M.
|
|
|
|

|
When doing a large number of file transfers, the system will crash for memory problem.
|
|
|
|

|
Hi, Paolo, I very thank your great job first!
I have found serval bugs in your program. One of them is that the program run very well in WINDOWS98(Client)/Windows98(Server), or Window2k|XP(Client)/Windows2k|XP running mode, but there will be a bug in Windows98(client)/Windows2K|XP running mode. The client software is using your FTP client program.
I found the receive() got a big problem.
If a FTP transfer finished sucessfully, the program will use the Receive() function at least twice. First time. it receive the data of XXX characters, XXX is less or equal to PACKET_SIZE, second it must be 0 character.
But in Win98(client)/Win2K(Server) mode, sometime the program only pass the function one time. so it not past the statement:
case 0: m_File.Close();
It get a big problem.
How to fix the bug? Thanks
coolzerg
int CDataSocket::Receive()
{
int nRead = 0;
if (m_nStatus == XFERMODE_RECEIVE)
{
if (m_File.m_hFile == NULL)
return 0;
byte data[PACKET_SIZE];
nRead = CAsyncSocket::Receive(data, PACKET_SIZE);
switch(nRead)
{
case 0:
{
m_File.Close();
m_File.m_hFile = NULL;
Close();
m_pConnectSocket->SendResponse("226 Transfer complete 4");
AfxGetThread()->PostThreadMessage(WM_THREADMSG, 0, 0);
((CConnectThread *)AfxGetThread())->UpdateStatistic(FTPSTAT_UPLOADSUCCEEDED);
break;
}
case SOCKET_ERROR:
{
if (GetLastError() != WSAEWOULDBLOCK)
{
m_File.Close();
m_File.m_hFile = NULL;
Close();
m_pConnectSocket->SendResponse("426 Connection closed; transfer aborted.");
// destroy this socket
AfxGetThread()->PostThreadMessage(WM_THREADMSG, 0, 0);
// upload failed
((CConnectThread *)AfxGetThread())->UpdateStatistic(FTPSTAT_UPLOADFAILED);
}
break;
}
default:
{
((CConnectThread *)AfxGetThread())->IncReceivedBytes(nRead);
TRY
{
m_File.Write(data, nRead);
}
CATCH_ALL(e)
{
m_File.Close();
m_File.m_hFile = NULL;
Close();
m_pConnectSocket->SendResponse("450 can't access file.");
// destroy this socket
AfxGetThread()->PostThreadMessage(WM_THREADMSG, 0, 0);
// upload failed
((CConnectThread *)AfxGetThread())->UpdateStatistic(FTPSTAT_UPLOADFAILED);
ProcessFiles();
return 0;
}
END_CATCH_ALL;
}
}
}
return nRead;
}
|
|
|
|

|
In ControlSocket.cpp in the function OnReceive(), This line:
TCHAR buff[BUFFER_SIZE];
needs to be replaced with this line:
TCHAR buff[BUFFER_SIZE+1];
due to the buffer overflow in the code that does:
buff[nRead] = 0; // Buffer overflow here.
m_RxBuffer += CString(buff);
Jim.
|
|
|
|

|
I'm trying to compile source code with VS.NET 2003. It originally compiled with VC++6, so I know it works. I get two errors: f:\Development\FTPServer\UserManager.cpp(144): error C2664: 'CArray<TYPE,ARG_TYPE>::Add' : cannot convert parameter 1 from 'const CDirectory' to 'CDirectory &' with [ TYPE=CDirectory, ARG_TYPE=CDirectory & ] in CUser::CUser(const CUser &user) { ... m_DirectoryArray.Add(user.m_DirectoryArray[i]); }.. 2nd error: f:\Development\FTPServer\ConnectThread.cpp(146): error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CConnectThread::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' On BEGIN_MESSAGE_MAP... ...ON_MESSAGE(WM_THREADMSG, OnThreadMessage) Not having anything really with MFC, looked up help. ON_MESSAGE requires a CWnd derived class method for this macro? I can fix the first, don't know what to do with second. Regards, Tim
|
|
|
|

|
Is it possible to implement a script into this ftp server? I want to do automated transfers and also multiple transfers to the same client. How would I go about this?
Thank you!
Hella
Hella
|
|
|
|

|
The original sample application bypasses most of MFC debug-time verifications. The sample application's project file undefines the _DEBUG define. As a result no ASSERT() macros are executed, especially those in MFC's wincore.cpp.
This becomes apparent when you handle overridden OnFTPStatusChange() notifications and try to update your MFC object instance. The code ASSERTS in wincore.cpp because the call is made directly via a pointer to an MFC instance passed to another thread.
If you're going to use this code within another project, you'll have to implement the mechanism of invoking OnFTPStatusChange() via a message or using a HWND to get a hold of your MFC instance.
Victor Rosu.
|
|
|
|

|
I want to spy others machine, like what sites they browse, details emails send, whom to chat what to chat, documents send to others using yahoo, hotmail etc.
I want to check it on using vb. I just able to get what sites I browse in my machine, but if want to acces others machine giving their ip, it shows me the error.
Himadrish Laha
|
|
|
|

|
I compile your source code, if i select Using MFC in a Static library, the code could be compile and run, but, when any client try to connect to the server, the server then crash, why?
|
|
|
|

|
I work on a project(is about a ftp connection) and when I can't set time for "connection timed out"
I use CInternetSession::SetOption
Here are few lines from my project
CInternetSession sess(_T("MyProgram/1.0"));
CFtpConnection* pConnect = NULL;
sess.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT,2,0);
pConnect = sess.GetFtpConnection(_T("ftpgcbv.com"));
...
So can anyone help me with these pls?
|
|
|
|

|
Dear all
I have written a FTP Client, which connects to FTP services on win-2000 Server. Method GetFtpConnection() is workin fine. But when I try GetFile() or OpenFile(), its returning an error code 12003, ERROR_SXS_ASSEMBLYNOTFOUND,Can any one enlighten me on how to solve this problem.
Thanks in Advance
Girish
|
|
|
|

|
How can I turning the server into UTF8 mode ??
The client will send 'OPTS UTF8 ON|OF' to open or close the UTF8 character mode.
But your FTP Server cant't do this command.
So when I use IE6 with UTF8, it will receive the error file or directory name listing.
Do you have any solution ?
Thanks^_^
Golick
|
|
|
|

|
I downloaded your source and exe for your complete FTP Server. I needed to write a FTP server which runs on a PocketPC 2002. So, I ported your code over to embedded VC 3.0 (stripping most of your UI code).
I finally got it to compile and run. However, I never get the OnAccept event to fire for the CListenSocket. (I compiled your source and ran it on the PC to see what I might be missing. I noticed that the "framework" issues a ON_NOTIFY_SOCKET message (#883) which then triggers the OnAccept event in CListenSocket. I do not think I ever get this message on the PDA.
The PocketPC doc says that I should use CCeSocket rather than CAsyncSocket under CE if I want to do asynchronous communication. I did make that change. Any ideas?
My application runs - I can start the Server and stop the server just fine. I just never get any triggers to my listening socket.
Thanks in advance,
vikkip@safeenv.com
vikkipitts@aol.com
Vikki Pitts
Safe Environment
|
|
|
|

|
When I use WINCMD32 to upload a directory, the directory have some subdirs and files, this FTP server always crash!
|
|
|
|

|
I was able to compile your server into a new MFC Dialog app, but now when I try to connect to the FTP server, it crashes in this code:
CAsyncSocket* PASCAL CAsyncSocket::LookupHandle(SOCKET hSocket, BOOL bDead)
{
CAsyncSocket* pSocket;
_AFX_SOCK_THREAD_STATE* pState = _afxSockThreadState;
if (!bDead)
{
pSocket = (CAsyncSocket*)
pState->m_pmapSocketHandle->GetValueAt((void*)hSocket);
because m_pmapSocketHandle is NULL. How do I fix that problem?
Thanks!
P.S. Thanks for this program; once I get it working, it'll greatly simplify the app I'm working on
|
|
|
|
|

|
hi,
Great work but, i found one problem.
After selecting user accounts page, after placing focus on user accounts page, on pressing enter key closing the user accounts page. Why it is closing user accounts page on pressing enter key.
Chito.
|
|
|
|

|
When I try to compile this project in VC++ .Net I get the following error....
C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CClientThread::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
Does anyone know what I need to do to be able to compile FTP Server in VC++ .Net
|
|
|
|

|
Thanxs, You're right, just insert in ConnectThread.cpp
...
BOOL CConnectThread::InitInstance()
{
#ifndef _AFXDLL
VERIFY( AfxSocketInit()); // This solve statical link problem
#endif
try
{
....
and it works in both configuration.
Davide
|
|
|
|

|
To avoid problem on shared library I'm used to set "Static Library Link".
Changing settings in this project lead to fatal errors during execution (just recompile and open a ftp connection).
Can the author or anyone else spot this problem ?
TIA
Davide
|
|
|
|

|
same file 2 over user Receive
one user receiveing & other user blocking
repair source
PrepareSendFile()
{
m_File.Open(lpszFilename, CFile::modeRead | *CFile::shareDenyNone* |CFile::typeBinary)
}
test result non blocking & sucess receive
byebye~
|
|
|
|

|
I can't get filezilla or this ftp server to work....bummer (
|
|
|
|

|
Hi there,
I'm verymuch concern about the security issue with the server? Is there any provision for the encryption while transferring the data to/from the server?
Regards,
Paras shah
|
|
|
|

|
Excelent server. Thank you for sharing!
This code will help me alot with how to build a cool user interface.
Thanx again.
Guilherme Magalhaes - MCP, MCSD, CCNA
|
|
|
|

|
as an author of an ftp server myself www.bmftp.com here are some tips. Use a stack to take care of your ..\..\ problem. you just tokenize words between the \, push into a stack if it's not ".." and pop the stack if it's ".."
when you're done build the string back up and you'll get the correct location where the user wants to go. Have some sort of function that does this on every path the user wants to go to.
also have a function that checks the names of invalid files, like COMx, LPTx, CLOCK$ etc
|
|
|
|
|

|
I am the author of FileZilla, an open source (GPL) FTP client and server.
I've analyzed the code of this server and it is clearly visible that this program uses code from FileZilla Server beta 0.3 (see my sig for the URL). Large parts of the server core are very similar to FileZilla server: Same code, same strings, only the variable names have changed.
Prove: Compare FileZilla's CControlSocket::ParseCommand and CUsersDlg::GetRealDirectory with this program's CConnectSocket::ParseCommand and CUserManager::ConvertPathToLocal
This is just an example, there is more code copied from FileZilla Server
This all would be no problem, but since FileZilla Server is licensed under the GPL, this program violates the GPL because:
a) It is not published under the GPL as well
b) The auther does claim that he wrote it himself
c) There are absolutely no references to the original program
Here are the relevant parts of the GPL:
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
---
Author of FileZilla FTP
http://sourceforge.net/projects/filezilla
|
|
|
|
|

|
For each USER command sent to the server, the user is added to the active users list.
When sending 100 USER commands, 100 users get added to the active users list.
But they don't get removed when the user disconnects.
---
Author of FileZilla FTP
http://sourceforge.net/projects/filezilla
|
|
|
|
|

|
This FTP Server allows you to fully access directories outside the ftp-root!
Create a new FTP accout and set up a home dir for this user, at least with download permission.
Connect to the server and send this command to the server: "CWD /../../../"
The server will change the current directory to "/.." from there with is OUTSIDE the ftp root. Now you can access every other directory below it with the same rights the home dir has. Adding more "../" to the CWD command allows a malicious user to reach even more directoris outside the ftp root.
This is a critical security hole, complete access to the disk which contains the home dir can be achieved.
---
Author of FileZilla FTP, the GPL FTP client and server
http://sourceforge.net/projects/filezilla
|
|
|
|

|
This is a great contribution to Code Project and an excellent learning opportunity for everybody. And it happens to jog nicely alongside what I'm currently working on (and fumbling with!) and is very much appreciated.
- Jason
(SonorkID 100.611)
In the beginning, teachers taught the 5 W's: who, what, where, when, why. Now it's just a big damn G
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
This article presents a fully functional implementation of a FTP server.
| Type | Article |
| Licence | |
| First Posted | 11 Jul 2002 |
| Views | 329,896 |
| Bookmarked | 145 times |
|
|