Public Member Functions |
| | DtFileTransporter (int port=DtDEFAULT_PORT, bool findFirstAvailable=false, int portRangeToTry=10, const DtFilename &tagetDirectory=".", int *status=0) |
| | Constructor.
|
| virtual | ~DtFileTransporter () |
| | Destructor.
|
| virtual void | tick () |
| | Do periodic processing.
|
| virtual unsigned int | port () const |
| | Get our listening port.
|
| virtual void | addFileTransferedCallback (DtFileTransferedCallbackFn fn, void *data) |
| | Add/Remove callbacks to be invoked when a new file has been transfered to us.
|
| virtual void | removeFileTransferedCallback (DtFileTransferedCallbackFn fn, void *data) |
| virtual bool | sendFile (const DtFilename &filename, DtIpv4Addr destAddr, int port) |
| | Sends a file to the given destAddr and port.
|
| virtual bool | sendFile (const DtFilename &filename, DtIpv4Addr destAddr) |
| | Sends a file to the given destAddr using the myPort.
|
| const DtFilename & | targetDirectory () const |
| | Set/Get the directory where incoming files will be stored When setting a new directory, the given directory will be created if it does not exist already.
|
| void | setTargetDirectory (const DtFilename &f) |
Static Public Member Functions |
| static void | receiveFileCb (DtTcpSocket *sock, void *usr) |
| | Invoked when a socket connects to us.
|
Member Typedef Documentation
| typedef void(* DtFileTransporter::DtFileTransferedCallbackFn)(const DtFilename &file, void *usr) |
Member Enumeration Documentation
- Enumerator:
| DtFileNormal |
|
| DtFileCompressed |
|
| DtFileEncrypted |
|
Constructor & Destructor Documentation
| DtFileTransporter::DtFileTransporter |
( |
int |
port = DtDEFAULT_PORT, |
|
|
bool |
findFirstAvailable = false, |
|
|
int |
portRangeToTry = 10, |
|
|
const DtFilename & |
tagetDirectory = ".", |
|
|
int * |
status = 0 |
|
) |
| |
Constructor.
Accepts incoming data from the given port. Set findFirstAvailable to true when you want the listener to try to find the next free port if the given port is already in use. If the suggested port is not free, and findFirstAvailable is set to true, DtFileTransporter will try the next portRangeToTry ports. On success status returns the port which was opened for reading. On failure status returns a negative value.
| virtual DtFileTransporter::~DtFileTransporter |
( |
| ) |
|
|
virtual |
Copy CTOR Not Implemented.
Member Function Documentation
Add/Remove callbacks to be invoked when a new file has been transfered to us.
Writes out file and removed transport object from active file list.
| virtual int DtFileTransporter::nextFileIdentifier |
( |
| ) |
|
|
protectedvirtual |
Returns the next unique identifier for the file to be sent.
Used when reading in files from the network to make sure that file packets are associated with the right files
Assignment Operator Not Implemented.
| virtual unsigned int DtFileTransporter::port |
( |
| ) |
const |
|
virtual |
Get our listening port.
(Ie. the port number on which we are receiving connections)
| virtual bool DtFileTransporter::readFileToBuffer |
( |
std::ifstream & |
inFile, |
|
|
std::vector< char > & |
fileBuffer, |
|
|
int |
fileLengthInBytes, |
|
|
int & |
retBufLen, |
|
|
DtFileTransportFlags & |
flags |
|
) |
| |
|
protectedvirtual |
Reads the file into the supplied vector buffer.
The retBufLen pointer will contain the actual size of the buffer. Set flags to any changes that are made to the file read in.
Set retBufLen to the actual size of the returned buffer. By default it will be set to fileLengthInBytes
| virtual void DtFileTransporter::receiveFile |
( |
DtTcpSocket * |
sock | ) |
|
|
protectedvirtual |
Called when a socket connects to us.
This should never be called directly by users. Instead, users should register a callback to know when a file has been received.
| static void DtFileTransporter::receiveFileCb |
( |
DtTcpSocket * |
sock, |
|
|
void * |
usr |
|
) |
| |
|
static |
Invoked when a socket connects to us.
| virtual bool DtFileTransporter::sendFile |
( |
const DtFilename & |
filename, |
|
|
DtIpv4Addr |
destAddr, |
|
|
int |
port |
|
) |
| |
|
virtual |
Sends a file to the given destAddr and port.
Sends a file to the given destAddr using the myPort.
| void DtFileTransporter::setTargetDirectory |
( |
const DtFilename & |
f | ) |
|
| const DtFilename& DtFileTransporter::targetDirectory |
( |
| ) |
const |
Set/Get the directory where incoming files will be stored When setting a new directory, the given directory will be created if it does not exist already.
The default is the current directory.
| virtual void DtFileTransporter::tick |
( |
| ) |
|
|
virtual |
Member Data Documentation
| int DtFileTransporter::myPort |
|
protected |
The documentation for this class was generated from the following file: