---
name: "FTPSocket"
section: "3cc"
platform: "linux"
package: "libcommoncpp2-dev"
version: "1.0.13-5"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/FTPSocket"
---

# FTPSocket(3cc)

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

## NAME

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

## SYNOPSIS

`#include <ftp.h>`

### Public Types

typedef set\< **DirEntry**, **DirEntry::Compare** \> **DirType**\
 *set of direntries*

### Public Methods

void **sendCommand** (string cmd)\
 *low level functions* int **getResponse** (string \*resp=0)\
 **FTPSocket** ()\
 *empty constructor* **FTPSocket** (**InetHostAddress** host, **timeout\_t** to=0)\
 *constructor; connects to a host on creation* **FTPSocket** (**InetHostAddress** host, string user, string passwd, **timeout\_t** to=0)\
 *constructor; connects to a host and logs in* **~FTPSocket** ()\
 *destructor; logs out and disconnects if needed* void **setAscii** ()\
 *set ascii-mode for datatransfer* void **setEbcdic** ()\
 *set ebcdic-mode for datatransfer* void **setBinary** ()\
 *set binary-mode for datatransfer* string **command** (string cmd)\
 *process a ftp-command* void **open** (**InetHostAddress** host, **timeout\_t** to=0)\
 *sessionmanagement* void **open** (**InetHostAddress** host, string user, string passwd, **timeout\_t** to=0)\
 *creates a connection to host and logs in* void **login** (string user, string passwd)\
 *logs in to a host; connection must be set up* void **close** (void)\
 *log out* void **quit** (void)\
 *close connection* **DirType** **getDir** (string dir='', **timeout\_t** to=0)\
 *get directory* string **pwd** (void)\
 *get current working directory on the server* void **cwd** (string dir)\
 *change current working directory on the server* void **cdup** (void)\
 *change current working directory* void **put** (string file, string rfilename, **timeout\_t** to=0)\
 *send local file to remote* void **put** (string file, **timeout\_t** to=0)\
 *send local file to remote; local and remote filenames are identical* void **get** (string file, string lfilename, **timeout\_t** to=0)\
 *get file from server* void **get** (string file, **timeout\_t** to=0)\
 *get file from server; local and remote filenames are identical* void **remove** (string file)\
 *delete file from server* void **rename** (string from, string to)\
 *rename file on server* void **mkdir** (string dir)\
 *create directory on server* void **rmdir** (string dir)\
 *remove directory on server*

### Static Public Methods

void **setDebug** (int d=1)\
 *enable debugging* int **getDebug** ()\
 *queries debugging*

### 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.

**Author:**  Dr. Eckhardt and Partner GmbH

## MEMBER TYPEDEF DOCUMENTATION

### typedef set\<DirEntry, DirEntry::Compare\> FTPSocket::DirType

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, string user, 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::cdup (void)

change current working directory

### void FTPSocket::close (void)

log out

### string FTPSocket::command (string cmd)

process a ftp-command

### void FTPSocket::cwd (string dir)

change current working directory on the server

### void FTPSocket::get (string file, timeout\_t to = 0)` [inline]`

get file from server; local and remote filenames are identical

### void FTPSocket::get (string file, string lfilename, timeout\_t to = 0)

get file from server

### int FTPSocket::getDebug ()` [inline, static]`

queries debugging

### DirType FTPSocket::getDir (string dir = '', timeout\_t to = 0)

get directory

### int FTPSocket::getResponse (string \* resp = 0)

### void FTPSocket::login (string user, string passwd)

logs in to a host; connection must be set up

### void FTPSocket::mkdir (string dir)

create directory on server

### void FTPSocket::open (InetHostAddress host, string user, 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 (string file, timeout\_t to = 0)` [inline]`

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

### void FTPSocket::put (string file, string rfilename, timeout\_t to = 0)

send local file to remote

### string FTPSocket::pwd (void)

get current working directory on the server

### void FTPSocket::quit (void)

close connection

### void FTPSocket::remove (string file)

delete file from server

### void FTPSocket::rename (string from, string to)

rename file on server

### void FTPSocket::rmdir (string dir)

remove directory on server

### void FTPSocket::sendCommand (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]`

## AUTHOR

Generated automatically by Doxygen for CommonC++ from the source code.
