active mode support for wxFTP (extremely heavily modified patch 1006252)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29204 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -42,7 +42,7 @@ public:
|
||||
void SetUser(const wxString& user) { m_user = user; }
|
||||
void SetPassword(const wxString& passwd) { m_passwd = passwd; }
|
||||
|
||||
bool Connect(wxSockAddress& addr, bool wait = TRUE);
|
||||
bool Connect(wxSockAddress& addr, bool wait = true);
|
||||
bool Connect(const wxString& host);
|
||||
|
||||
// disconnect
|
||||
@@ -51,6 +51,8 @@ public:
|
||||
// Parameters set up
|
||||
|
||||
// set transfer mode now
|
||||
void SetPassive(bool pasv) { m_bPassive = pasv; };
|
||||
void SetDefaultTimeout(wxUint32 Value);
|
||||
bool SetBinary() { return SetTransferMode(BINARY); }
|
||||
bool SetAscii() { return SetTransferMode(ASCII); }
|
||||
bool SetTransferMode(TransferMode mode);
|
||||
@@ -104,7 +106,7 @@ public:
|
||||
bool GetFilesList(wxArrayString& files,
|
||||
const wxString& wildcard = wxEmptyString)
|
||||
{
|
||||
return GetList(files, wildcard, FALSE);
|
||||
return GetList(files, wildcard, false);
|
||||
}
|
||||
|
||||
// get a directory list in server dependent format - this can be shown
|
||||
@@ -112,17 +114,17 @@ public:
|
||||
bool GetDirList(wxArrayString& files,
|
||||
const wxString& wildcard = wxEmptyString)
|
||||
{
|
||||
return GetList(files, wildcard, TRUE);
|
||||
return GetList(files, wildcard, true);
|
||||
}
|
||||
|
||||
// equivalent to either GetFilesList() (default) or GetDirList()
|
||||
bool GetList(wxArrayString& files,
|
||||
const wxString& wildcard = wxEmptyString,
|
||||
bool details = FALSE);
|
||||
bool details = false);
|
||||
|
||||
protected:
|
||||
// this executes a simple ftp command with the given argument and returns
|
||||
// TRUE if it its return code starts with '2'
|
||||
// true if it its return code starts with '2'
|
||||
bool DoSimpleCommand(const wxChar *command,
|
||||
const wxString& arg = wxEmptyString);
|
||||
|
||||
@@ -133,7 +135,19 @@ protected:
|
||||
// check that the result is equal to expected value
|
||||
bool CheckResult(char ch) { return GetResult() == ch; }
|
||||
|
||||
wxSocketClient *GetPort();
|
||||
// return the socket to be used, Passive/Active versions are used only by
|
||||
// GetPort()
|
||||
wxSocketBase *GetPort();
|
||||
wxSocketBase *GetPassivePort();
|
||||
wxSocketBase *GetActivePort();
|
||||
|
||||
// helper for GetPort()
|
||||
wxString GetPortCmdArgument(wxIPV4address Local, wxIPV4address New);
|
||||
|
||||
// accept connection from server in active mode, returns the same socket as
|
||||
// passed in in passive mode
|
||||
wxSocketBase *AcceptIfActive(wxSocketBase *sock);
|
||||
|
||||
|
||||
wxString m_user,
|
||||
m_passwd;
|
||||
@@ -151,6 +165,14 @@ protected:
|
||||
friend class wxInputFTPStream;
|
||||
friend class wxOutputFTPStream;
|
||||
|
||||
bool m_bPassive;
|
||||
wxUint32 m_uiDefaultTimeout;
|
||||
|
||||
// following is true when a read or write times out, we then assume
|
||||
// the connection is dead and abort. we avoid additional delays this way
|
||||
bool m_bEncounteredError;
|
||||
|
||||
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxFTP)
|
||||
DECLARE_PROTOCOL(wxFTP)
|
||||
};
|
||||
|
Reference in New Issue
Block a user