|
| | DtInetFileTransporter (int port=3000, bool findFirstAvailable=false, int portRangeToTry=10, const DtFilename &tagetDirectory=".", int *status=0, bool useIpv6=false) |
| | Constructor. More...
|
| |
| virtual | ~DtInetFileTransporter () |
| | Destructor. More...
|
| |
| virtual void | tick () |
| | Do periodic processing. More...
|
| |
| virtual unsigned int | port () const |
| | Get our listening port. More...
|
| |
| virtual void | addFileTransferedCallback (DtInetFileTransferedCallbackFn fn, void *data) |
| | Add/Remove callbacks to be invoked when a new file has been transfered to us. More...
|
| |
| virtual void | removeFileTransferedCallback (DtInetFileTransferedCallbackFn fn, void *data) |
| |
| virtual bool | sendFile (const DtFilename &filename, const DtInetAddr &destAddr, int port) |
| | Sends a file to the given destAddr and port. More...
|
| |
| virtual bool | sendFile (const DtFilename &filename, const DtInetAddr &destAddr) |
| | Sends a file to the given destAddr using the myPort. More...
|
| |
| 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. More...
|
| |
| void | setTargetDirectory (const DtFilename &f) |
| |
| typedef void(* DtInetFileTransporter::DtInetFileTransferedCallbackFn)(const DtFilename &file, void *usr) |
| Enumerator |
|---|
| DtFileNormal |
|
| DtFileCompressed |
|
| DtFileEncrypted |
|
| DtInetFileTransporter::DtInetFileTransporter |
( |
int |
port = 3000, |
|
|
bool |
findFirstAvailable = false, |
|
|
int |
portRangeToTry = 10, |
|
|
const DtFilename & |
tagetDirectory = ".", |
|
|
int * |
status = 0, |
|
|
bool |
useIpv6 = false |
|
) |
| |
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, DtInetFileTransporter 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 DtInetFileTransporter::~DtInetFileTransporter |
( |
| ) |
|
|
virtual |
Copy CTOR Not Implemented.
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 DtInetFileTransporter::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 DtInetFileTransporter::port |
( |
| ) |
const |
|
virtual |
Get our listening port.
(Ie. the port number on which we are receiving connections)
| virtual bool DtInetFileTransporter::readFileToBuffer |
( |
std::ifstream & |
inFile, |
|
|
std::vector< char > & |
fileBuffer, |
|
|
int |
fileLengthInBytes, |
|
|
int & |
retBufLen, |
|
|
DtInetFileTransportFlags & |
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
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 bool DtInetFileTransporter::receiveFileCb |
( |
DtInetSocket * |
sock, |
|
|
void * |
usr |
|
) |
| |
|
static |
Invoked when a socket connects to us.
Sends a file to the given destAddr and port.
Sends a file to the given destAddr using the myPort.
| void DtInetFileTransporter::setTargetDirectory |
( |
const DtFilename & |
f | ) |
|
| const DtFilename& DtInetFileTransporter::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 DtInetFileTransporter::tick |
( |
| ) |
|
|
virtual |
| int DtInetFileTransporter::myPort |
|
protected |
| DtFilename DtInetFileTransporter::myTargetDirectory |
|
protected |
The documentation for this class was generated from the following file: