|
Hi,
I'm using this code for linux and did some changes from another post (see below).
I added:
-------------
In Definements.h need to change find, insert, erase all to this->find, this->insert, this->erase.
In BlockingSocket.h under the #elif defined (unix) add these includes:
#include <unistd.h>
#include <cstddef>
-------------------
Now I'm getting error when I compile..I don't know how to fix it. Can someone help?
/src/core/ftp/FTPDataTypes.h:40:49: error: array 'nsFTP::ANONYMOUS_USER' initialized by parenthesized string literal '("anonymous")' [-Werror]
const TCHAR ANONYMOUS_USER[] = _T("anonymous"); // this the line that's causing this error.
|
|
|
|
|
bool CFTPClient::OpenControlChannel(const tstring& strServerHost, USHORT ushServerPort/*=DEFAULT_FTP_PORT*/)
{
CloseControlChannel();
try
{
m_apSckControlConnection->Create(SOCK_STREAM);
CSockAddr adr = m_apSckControlConnection->GetHostByName(CCnv::ConvertToString(strServerHost).c_str(), ushServerPort);
m_apSckControlConnection->Connect(adr);
}
catch(CBlockingSocketException& blockingException)
{
ReportError(blockingException.GetErrorMessage(), CCnv::ConvertToTString(__FILE__), __LINE__);
m_apSckControlConnection->Cleanup();
return false;
}
return true;
}
|
|
|
|
|
Hello,
In order to use this class in a Pocket PC I needed to manually add Ws2.lib to additional libraries... However, there are 3 more unresolved externals I cannot fix. They are gmtime, asctime and time. They are referenced in FTPListParse.
How can I solve it?
Thanks
Jaime
|
|
|
|
|
I just tested the code and it works nicely, it was easy to get up and running. However, a lot of compilation warnings is produced by auto_ptr due to deprecation. It should be a rather easy fix since the new unique_ptr is almost equal to auto_ptr, at least for someone familiar with the code already. Therefore I would like to request a patch for this, if the developer feels he have the time. Thank you!
|
|
|
|
|
This library is garbage. It doesn't even compile or work. You can't even get it to link properly. You would literally save yourself more time writing an FTP client on your own than you would spending the next year f***ing with this piece of sh*t.
|
|
|
|
|
Using it on linux, you have to add a few includes and change a few variables, then it compiles.
In Definements.h need to change find, insert, erase all to this->find, this->insert, this->erase.
In BlockingSocket.h under the #elif defined (unix) add these includes:
#include <unistd.h>
#include <cstddef>
|
|
|
|
|
And for Windows, you have to link against the WS2_32.lib. E.g. directly in the code:
#pragma comment (lib, "Ws2_32.lib")
or, when using Qt/qmake and a .pro file:
win32: LIBS += -lWS2_32
or something similar when using another make system.
|
|
|
|
|
I managed to make it work both in linux and windows with Qt but couldn't figure out how to get the progress of a UP/DOWN transfert .
|
|
|
|
|
hi otom, thanks for you good job!
|
|
|
|
|
After 8 months I gave up with this library. I confirm previous clams about upload problems. This library can stop working in any moment.
It stops on _select call and throw exception "Timeout".
No documentation, no examples. Do not spend your time on it.
|
|
|
|
|
I had the same issue. _select() timed out after 10 seconds in CBlockingSocket::Receive().
Changing to passive mode (fPasv=true) solved my problem.
|
|
|
|
|
|
This is so well thought out, both the ftp client class and the examples around it. I could easily read the code and know how to work with it for my own program. So much possibilities. Love how easy you can do passive mode, which solved all my firewall issues. The progress dialog is a perfect example of incredibly good and useful programming. Wish everyone wrote such good code.
|
|
|
|
|
Hi,
i use this library in my program, works like a charm, thanks for the work.
One question: is it possible to keep the file modification date/time when uploading a file to a remote server?
Regards,
Matthias
|
|
|
|
|
i had download the latest version class , , everything is ok when i used the class to upload the files , like .txt . png .xml . but when i wanna upload compressed file , like .zip , the result show the file was damaged after uploaded . i had try to do some search about this issue , it seems the zip file is binary , require binary format transfer , but i did not find where to set , the default setting i take is
CRepresentation(nsFTP::CType::ASCII()). and the API only give me four options :
(nsFTP::CType::ASCII())
nsFTP::CType::EBCDIC()
nsFTP::CType::Image()
nsFTP::CType::LocalByte()
both of the option could not guarantee the zip file un-damaged , is this issue a bug ? or there need something else setting to make sure
the zip file not damaged ? could you do me a favor ??
|
|
|
|
|
FtpCommand(hConnect, FALSE, FTP_TRANSFER_TYPE_BINARY, command, NULL, NULL);
|
|
|
|
|
Hi
I am trying to get only the first 256 bytes from a file; so in an implementation of nsFTP::CFTPClient::CNotification on OnBytesReceived I call Abort;
It stops but block until timout and I get 'Receive timeout error ==> Datei "...\ftpclient\ftpclient.cpp" (1274)' in function GetSingleResponseLine
why ? and how can I stop a download at some point (I dont have any GUI) ?
Thank You
|
|
|
|
|
Hello,
I use your code to interact with a product by FTP.
I use it on microsoft visual studio 2010.
Yesterday it works perfectly and now I always obtain an error when i send my file.
When i try to the same manually by using Filezilla, it works.
here my code simplify
nsFTP::CFTPClient ftpClient;
nsFTP::CLogonInfo logonInfo("192.168.1.1", 5551, "anonymous","anonymous@user.com");
ftpClient.Login(logonInfo);
success = ftpClient.IsConnected();
success = ftpClient.UploadFile(mStructure.PayloadPath.c_str(),"/jpsumo_update.plf");
So i just login on the FTP, theni check if i am connected. The answer is true so for i am connected.
Then i try to upload the file.
Yesterday, the file was copied perfectly and now, I obtain always false. When i check the product with Filezilla. the file is here but he is empty (its length is 0 byte).
Do you have an idea why it works before but not todau. I precise that i change nothing on this part.
Thanks and regard,
Emile GAULTIER.
|
|
|
|
|
If it was working fine earlier, then check
if file @ mStructure.PayloadPath exists
and its size.
|
|
|
|
|
I have already check the path of this file. I can assure you that it exist.
The size of the file is about 13 mo. Is there a limit of size to upload a file ?
|
|
|
|
|
I have done some test to correct this problem.
I was thinking that i found the problem.
The product that i am connect by FTP was not completely started when i send the file.
So i can be connected to the product but the upload failed.
I add a sleep of few seconds and it work correctly on visual studio and with the software created.
But when i have created the installer of the software and install it on the same computer, it don't work.
I have the same problem, i can connect to the FTP but i cannot upload my file.
I am sure the file exist because when i use the same path with the application in visual studio it work correctly.
I search the error in the code and i found that the error came from a catch exception with the message timeout. We try to change the timeout definition from 10 to 200 but wwe obtain the same error.
|
|
|
|
|
|
I have some errors trying to build this code using QTCreator :
Definements.h:237: error: no matching function for call to 'find(nsFTP::CFTPClient::CNotification*&)'
if (find(p)!=base_type::end())
Definements.h:239: error: 'insert' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
insert(p);
...
Any idea ?
|
|
|
|
|
Use this->find(p) instead of find(p) alone. Also repeat that for insert and erase functions.
It should solve your problem
|
|
|
|
|
I am looking for append functionality. I.E I would like to write to an exisitng file on the server. Does this code support it?
|
|
|
|