This class accepts datagrams one-at-a-time and sends them over the net, via a TCP connection. More...
#include "datagramSinkNet.h"
Public Member Functions | |
DatagramSinkNet (ConnectionManager *manager, int num_threads) | |
Creates a new DatagramSinkNet with the indicated number of threads to handle writing. More... | |
virtual void | flush () |
Ensures that all datagrams previously written will be visible on the stream. More... | |
Connection * | get_target () const |
Returns the current target Connection, or NULL if the target has not yet been set. More... | |
virtual bool | is_error () |
Returns true if there is an error on the target connection, or if the target has never been set. More... | |
virtual bool | put_datagram (const Datagram &data) |
Sends the given datagram to the target. More... | |
void | set_target (Connection *connection) |
Specifies the Connection that will receive all future Datagrams sent. More... | |
Public Member Functions inherited from DatagramSink | |
DatagramSink () | |
Does nothing since this is class is just the definition of an interface. More... | |
virtual | ~DatagramSink () |
Does nothing since this is class is just the definition of an interface. More... | |
virtual bool | copy_datagram (SubfileInfo &result, const Filename &filename) |
Copies the file data from the entire indicated file (via the vfs) as the next datagram. More... | |
virtual bool | copy_datagram (SubfileInfo &result, const SubfileInfo &source) |
Copies the file data from the range of the indicated file (outside of the vfs) as the next datagram. More... | |
virtual const FileReference * | get_file () |
virtual std::streampos | get_file_pos () |
virtual const Filename & | get_filename () |
Public Member Functions inherited from ConnectionWriter | |
ConnectionWriter (ConnectionManager *manager, int num_threads, const std::string &thread_name=std::string()) | |
Creates a new ConnectionWriter with the indicated number of threads to handle output. More... | |
int | get_current_queue_size () const |
Returns the current number of things in the queue. More... | |
ConnectionManager * | get_manager () const |
Returns a pointer to the ConnectionManager object that serves this ConnectionWriter. More... | |
int | get_max_queue_size () const |
Returns the maximum size the queue is allowed to grow to. More... | |
int | get_num_threads () const |
Returns the number of threads the ConnectionWriter has been created with. More... | |
bool | get_raw_mode () const |
Returns the current setting of the raw mode flag. More... | |
int | get_tcp_header_size () const |
Returns the current setting of TCP header size. More... | |
bool | is_immediate () const |
Returns true if the writer is an immediate writer, i.e. More... | |
bool | is_valid_for_udp (const Datagram &datagram) const |
Returns true if the datagram is small enough to be sent over a UDP packet, false otherwise. More... | |
bool | send (const Datagram &datagram, const PT(Connection) &connection, bool block=false) |
Enqueues a datagram for transmittal on the indicated socket. More... | |
bool | send (const Datagram &datagram, const PT(Connection) &connection, const NetAddress &address, bool block=false) |
Enqueues a datagram for transmittal on the indicated socket. More... | |
void | set_max_queue_size (int max_size) |
Limits the number of packets that may be pending on the outbound queue. More... | |
void | set_raw_mode (bool mode) |
Sets the ConnectionWriter into raw mode (or turns off raw mode). More... | |
void | set_tcp_header_size (int tcp_header_size) |
Sets the header size of TCP packets. More... | |
void | shutdown () |
Stops all the threads and cleans them up. More... | |
Additional Inherited Members | |
Public Attributes inherited from DatagramSink | |
get_file | |
Returns the FileReference that provides the target for these datagrams, if any, or NULL if the datagrams do not written to a file on disk. More... | |
get_file_pos | |
Returns the current file position within the data stream, if any, or 0 if the file position is not meaningful or cannot be determined. More... | |
get_filename | |
Returns the filename that provides the target for these datagrams, if any, or empty string if the datagrams do not get written to a file on disk. More... | |
This class accepts datagrams one-at-a-time and sends them over the net, via a TCP connection.
Definition at line 26 of file datagramSinkNet.h.
|
explicit |
Creates a new DatagramSinkNet with the indicated number of threads to handle writing.
Normally num_threads should be either 0 or 1 to guarantee that datagrams are delivered in the same order in which they were sent.
Definition at line 24 of file datagramSinkNet.cxx.
|
virtual |
Ensures that all datagrams previously written will be visible on the stream.
Implements DatagramSink.
Definition at line 55 of file datagramSinkNet.cxx.
|
inline |
Returns the current target Connection, or NULL if the target has not yet been set.
See set_target().
Definition at line 27 of file datagramSinkNet.I.
|
virtual |
Returns true if there is an error on the target connection, or if the target has never been set.
Implements DatagramSink.
Definition at line 46 of file datagramSinkNet.cxx.
|
virtual |
Sends the given datagram to the target.
Returns true on success, false if there is an error. Blocks if necessary until the target is ready.
Implements DatagramSink.
Definition at line 34 of file datagramSinkNet.cxx.
|
inline |
Specifies the Connection that will receive all future Datagrams sent.
Definition at line 18 of file datagramSinkNet.I.