#pragma hdrstop
#endif
+#if wxUSE_SOCKETS
+
#ifndef __MWERKS__
#include <memory.h>
#endif
class wxInputFTPStream : public wxSocketInputStream {
public:
wxFTP *m_ftp;
+ size_t m_ftpsize;
wxInputFTPStream(wxFTP *ftp_clt, wxSocketBase *sock)
: wxSocketInputStream(*sock), m_ftp(ftp_clt) {}
+ size_t StreamSize() const { return m_ftpsize; }
virtual ~wxInputFTPStream(void)
{
if (LastError() != wxStream_NOERROR)
wxInputStream *wxFTP::GetInputStream(const wxString& path)
{
wxString tmp_str;
- size_t calc_size;
+ int pos_size;
+ wxInputFTPStream *in_stream;
if (!SendCommand("TYPE I", '2'))
return NULL;
if (!SendCommand(tmp_str, '1'))
return NULL;
- return new wxInputFTPStream(this, sock);
+ in_stream = new wxInputFTPStream(this, sock);
+
+ pos_size = m_lastResult.Index('(');
+ if (pos_size != wxNOT_FOUND) {
+ wxString str_size = m_lastResult(pos_size+1, m_lastResult.Index(')')-1);
+
+ in_stream->m_ftpsize = atoi(WXSTRINGCAST str_size);
+ }
+
+ return in_stream;
}
wxOutputStream *wxFTP::GetOutputStream(const wxString& path)
return NULL;
}
+ sock->SetEventHandler(*GetNextHandler(), m_id);
+ sock->Notify(m_notifyme);
+ sock->SetNotify(m_neededreq);
+
return file_list;
}
+#endif
+ // wxUSE_SOCKETS