Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

FTPSocket Class Reference

This class represents a FTP-client to be used in c++-programms. ftp access stream class. More...

#include <ftp.h>

List of all members.

Public Types

typedef set< direntry, direntry::_comparedir_type
 set of direntries. More...


Public Methods

void sendCommand (std::string cmd)
 low level functions. More...

int getResponse (std::string *resp=0)
 FTPSocket ()
 empty constructor. More...

 FTPSocket (InetHostAddress host, timeout_t to=0)
 constructor; connects to a host on creation. More...

 FTPSocket (InetHostAddress host, std::string user, std::string passwd, timeout_t to=0)
 constructor; connects to a host and logs in. More...

 ~FTPSocket ()
 destructor; logs out and disconnects if needed. More...

void setAscii ()
 set ascii-mode for datatransfer. More...

void setEbcdic ()
 set ebcdic-mode for datatransfer. More...

void setBinary ()
 set binary-mode for datatransfer. More...

std::string Command (std::string cmd)
 process a ftp-command. More...

void Open (InetHostAddress host, timeout_t to=0)
 sessionmanagement. More...

void Open (InetHostAddress host, std::string user, std::string passwd, timeout_t to=0)
 creates a connection to host and logs in. More...

void Login (std::string user, std::string passwd)
 logs in to a host; connection must be set up. More...

void Close (void)
 log out. More...

void Quit (void)
 close connection. More...

dir_type getDir (std::string dir="", timeout_t to=0)
 get directory. More...

std::string pwd (void)
 get current working directory on the server. More...

void cwd (std::string dir)
 change current working directory on the server. More...

void cdup (void)
 change current working directory. More...

void Put (std::string file, std::string rfilename, timeout_t to=0)
 send local file to remote. More...

void Put (std::string file, timeout_t to=0)
 send local file to remote; local and remote filenames are identical. More...

void Get (std::string file, std::string lfilename, timeout_t to=0)
 get file from server. More...

void Get (std::string file, timeout_t to=0)
 get file from server; local and remote filenames are identical. More...

void remove (std::string file)
 delete file from server. More...

void rename (std::string from, std::string to)
 rename file on server. More...

void mkdir (std::string dir)
 create directory on server. More...

void rmdir (std::string dir)
 remove directory on server. More...


Static Public Methods

void setDebug (int d=1)
 enable debugging. More...

int getDebug ()
 queries debugging. More...


Protected Attributes

TCPStream * cs

Static Protected Attributes

int debug

Friends

class oftpstream
class iftpstream


Detailed Description

This class represents a FTP-client to be used in c++-programms. ftp access stream class.

It is based on the CommonC++-Framework.

Example use:

 include <iostream>
 include <iterator>
 include <algorithm>
 include <ftp.h>

 using namespace ost;
 using namespace std;

 int main()
 {
   try
   {
      ftp f("ftp.gnu.org", "anonymous", "my@email.adress.org");
      ftp::iftpstream in(f, "/pub/somefile.txt");
      copy(in.begin(), in.end(), output_iterator(cout));
   }
   catch(FTPException& e)
   {
        cerr << "exception occured: " << e.what() << endl;
        return 1;
   }
   return 0;
 }
 

Author:
Dr. Eckhardt and Partner GmbH


Member Typedef Documentation

typedef set<direntry, direntry::_compare> FTPSocket::dir_type
 

set of direntries.


Constructor & Destructor Documentation

FTPSocket::FTPSocket  
 

empty constructor.

FTPSocket::FTPSocket InetHostAddress   host,
timeout_t   to = 0
[explicit]
 

constructor; connects to a host on creation.

FTPSocket::FTPSocket InetHostAddress   host,
std::string   user,
std::string   passwd,
timeout_t   to = 0
 

constructor; connects to a host and logs in.

FTPSocket::~FTPSocket  
 

destructor; logs out and disconnects if needed.


Member Function Documentation

void FTPSocket::Close void  
 

log out.

std::string FTPSocket::Command std::string   cmd
 

process a ftp-command.

void FTPSocket::Get std::string   file,
timeout_t   to = 0
[inline]
 

get file from server; local and remote filenames are identical.

void FTPSocket::Get std::string   file,
std::string   lfilename,
timeout_t   to = 0
 

get file from server.

void FTPSocket::Login std::string   user,
std::string   passwd
 

logs in to a host; connection must be set up.

void FTPSocket::Open InetHostAddress   host,
std::string   user,
std::string   passwd,
timeout_t   to = 0
 

creates a connection to host and logs in.

void FTPSocket::Open InetHostAddress   host,
timeout_t   to = 0
 

sessionmanagement.

creates a connection to host

void FTPSocket::Put std::string   file,
timeout_t   to = 0
[inline]
 

send local file to remote; local and remote filenames are identical.

void FTPSocket::Put std::string   file,
std::string   rfilename,
timeout_t   to = 0
 

send local file to remote.

void FTPSocket::Quit void  
 

close connection.

void FTPSocket::cdup void  
 

change current working directory.

void FTPSocket::cwd std::string   dir
 

change current working directory on the server.

int FTPSocket::getDebug   [inline, static]
 

queries debugging.

dir_type FTPSocket::getDir std::string   dir = "",
timeout_t   to = 0
 

get directory.

int FTPSocket::getResponse std::string *   resp = 0
 

void FTPSocket::mkdir std::string   dir
 

create directory on server.

std::string FTPSocket::pwd void  
 

get current working directory on the server.

void FTPSocket::remove std::string   file
 

delete file from server.

void FTPSocket::rename std::string   from,
std::string   to
 

rename file on server.

void FTPSocket::rmdir std::string   dir
 

remove directory on server.

void FTPSocket::sendCommand std::string   cmd
 

low level functions.

void FTPSocket::setAscii  
 

set ascii-mode for datatransfer.

void FTPSocket::setBinary  
 

set binary-mode for datatransfer.

void FTPSocket::setDebug int   d = 1 [inline, static]
 

enable debugging.

void FTPSocket::setEbcdic  
 

set ebcdic-mode for datatransfer.


Friends And Related Function Documentation

friend class iftpstream [friend]
 

friend class oftpstream [friend]
 


Member Data Documentation

TCPStream* FTPSocket::cs [protected]
 

int FTPSocket::debug [static, protected]
 


The documentation for this class was generated from the following file:
Generated at Fri Jan 4 18:51:46 2002 for CommonC++ by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001