DatagramSinkNet

Inheritance:

Methods of DatagramSinkNet:

Methods of DatagramSink:

Methods of ConnectionWriter:

DatagramSinkNet
DatagramSinkNet::DatagramSinkNet(ConnectionManager *manager, int num_threads);

Description: 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.

getTarget
Connection *DatagramSinkNet::get_target(void) const;

Description: Returns the current target Connection, or NULL if the target has not yet been set. See set_target().

isError
virtual bool DatagramSinkNet::is_error(void);

Inherited from DatagramSink
Description: Returns true if there is an error on the target connection, or if the target has never been set.

putDatagram
virtual bool DatagramSinkNet::put_datagram(Datagram const &data);

Inherited from DatagramSink
Description: 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.

setTarget
void DatagramSinkNet::set_target(Connection *connection);

Description: Specifies the Connection that will receive all future Datagrams sent.

isError
virtual bool DatagramSink::is_error(void) = 0;

Undocumented function.

putDatagram
virtual bool DatagramSink::put_datagram(Datagram const &data) = 0;

Undocumented function.

ConnectionWriter
ConnectionWriter::ConnectionWriter(ConnectionManager *manager, int num_threads);

Description: Creates a new ConnectionWriter with the indicated number of threads to handle output.
If num_threads is 0, all datagrams will be sent immediately instead of queueing for later transmission by a thread.

getCurrentQueueSize
int ConnectionWriter::get_current_queue_size(void) const;

Description: Returns the current number of things in the queue.

getManager
ConnectionManager *ConnectionWriter::get_manager(void) const;

Description: Returns a pointer to the ConnectionManager object that serves this ConnectionWriter.

getMaxQueueSize
int ConnectionWriter::get_max_queue_size(void) const;

Description: Returns the maximum size the queue is allowed to grow to. See set_max_queue_size().

getNumThreads
int ConnectionWriter::get_num_threads(void) const;

Description: Returns the number of threads the ConnectionWriter has been created with.

getRawMode
bool ConnectionWriter::get_raw_mode(void) const;

Description: Returns the current setting of the raw mode flag. See set_raw_mode().

getTcpHeaderSize
int ConnectionWriter::get_tcp_header_size(void) const;

Description: Returns the current setting of TCP header size. See set_tcp_header_size().

isImmediate
bool ConnectionWriter::is_immediate(void) const;

Description: Returns true if the writer is an immediate writer, i.e. it has no threads.

isValidForUdp
bool ConnectionWriter::is_valid_for_udp(Datagram const &datagram) const;

Description: Returns true if the datagram is small enough to be sent over a UDP packet, false otherwise.

send
bool ConnectionWriter::send(Datagram const &datagram, PointerTo< Connection > const &connection, bool block = (0));

Description: Enqueues a datagram for transmittal on the indicated socket. Since the host address is not specified with this form, this function should only be used for sending TCP packets. Use the other send() method for sending UDP packets.
Returns true if successful, false if there was an error. In the normal, threaded case, this function only returns false if the send queue is filled; it's impossible to detect a transmission error at this point.
If block is true, this will not return false if the send queue is filled; instead, it will wait until there is space available.
Description: Enqueues a datagram for transmittal on the indicated socket. This form of the function allows the specification of a destination host address, and so is appropriate for UDP packets. Use the other send() method for sending TCP packets.

setMaxQueueSize
void ConnectionWriter::set_max_queue_size(int max_size);

Description: Limits the number of packets that may be pending on the outbound queue. This only has an effect when using threads; if num_threads is 0, then all packets are sent immediately.

setRawMode
void ConnectionWriter::set_raw_mode(bool mode);

Description: Sets the ConnectionWriter into raw mode (or turns off raw mode). In raw mode, datagrams are not sent along with their headers; the bytes in the datagram are simply sent down the pipe.
Setting the ConnectionWriter to raw mode must be done with care. This can only be done when the matching ConnectionReader is also set to raw mode, or when the ConnectionWriter is communicating to a process that does not expect datagrams.

setTcpHeaderSize
void ConnectionWriter::set_tcp_header_size(int tcp_header_size);

Description: Sets the header size of TCP packets. At the present, legal values for this are 0, 2, or 4; this specifies the number of bytes to use encode the datagram length at the start of each TCP datagram. Sender and receiver must independently agree on this.