1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: FTP protocol
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1997, 1998 Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
19 #include "wx/object.h"
20 #include "wx/sckaddr.h"
21 #include "wx/protocol/protocol.h"
24 class WXDLLEXPORT wxFTP
: public wxProtocol
27 typedef enum { ASCII
, BINARY
} wxFTPmode
;
32 bool Connect(wxSockAddress
& addr
, bool wait
= TRUE
);
33 bool Connect(const wxString
& host
);
35 // close the connection
38 void SetUser(const wxString
& user
) { m_user
= user
; }
39 void SetPassword(const wxString
& passwd
) { m_passwd
= passwd
; }
41 // Filesystem commands
42 bool ChDir(const wxString
& dir
);
43 bool MkDir(const wxString
& dir
);
44 bool RmDir(const wxString
& dir
);
46 bool Rename(const wxString
& src
, const wxString
& dst
);
47 bool RmFile(const wxString
& path
);
51 wxInputStream
*GetInputStream(const wxString
& path
);
52 wxOutputStream
*GetOutputStream(const wxString
& path
);
55 bool GetList(wxArrayString
& files
, const wxString
& wildcard
= wxEmptyString
);
58 bool SendCommand(const wxString
& command
, char exp_ret
);
59 virtual wxProtocolError
GetError() { return m_lastError
; }
60 const wxString
& GetLastResult(); // Get the complete return
63 wxList
*GetList(const wxString
& wildcard
);
66 wxString m_user
, m_passwd
;
67 wxString m_lastResult
;
68 wxProtocolError m_lastError
;
71 friend class wxInputFTPStream
;
72 friend class wxOutputFTPStream
;
74 wxSocketClient
*GetPort();
75 bool GetResult(char exp
);
77 DECLARE_DYNAMIC_CLASS(wxFTP
)
78 DECLARE_PROTOCOL(wxFTP
)
81 #endif // __WX_FTP_H__