|
|
|
This class handles threaded delivery of datagrams to various TCP or UDP sockets.
More...
#include "connectionWriter.h"
List of all members.
Detailed Description
This class handles threaded delivery of datagrams to various TCP or UDP sockets.
A ConnectionWriter may define an arbitrary number of threads (0 or more) to write its datagrams to sockets. The number of threads is specified at construction time and cannot be changed.
Definition at line 38 of file connectionWriter.h.
Constructor & Destructor Documentation
| ConnectionWriter::ConnectionWriter |
( |
ConnectionManager * |
manager, |
|
|
int |
num_threads, |
|
|
const string & |
thread_name = string() |
|
) |
| |
Member Function Documentation
| void ConnectionWriter::clear_manager |
( |
| ) |
[protected] |
| int ConnectionWriter::get_current_queue_size |
( |
| ) |
const |
| int ConnectionWriter::get_max_queue_size |
( |
| ) |
const |
| int ConnectionWriter::get_num_threads |
( |
| ) |
const |
| bool ConnectionWriter::get_raw_mode |
( |
| ) |
const |
| int ConnectionWriter::get_tcp_header_size |
( |
| ) |
const |
| bool ConnectionWriter::is_immediate |
( |
| ) |
const |
Returns true if the writer is an immediate writer, i.e.
it has no threads.
Definition at line 264 of file connectionWriter.cxx.
| bool ConnectionWriter::is_valid_for_udp |
( |
const Datagram & |
datagram | ) |
const |
| bool ConnectionWriter::send |
( |
const Datagram & |
datagram, |
|
|
const PT(Connection)& |
connection, |
|
|
bool |
block = false |
|
) |
| |
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.
Definition at line 166 of file connectionWriter.cxx.
References Connection::get_socket(), DatagramQueue::insert(), and TypedObject::is_exact_type().
Referenced by DatagramSinkNet::put_datagram().
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.
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.
Definition at line 206 of file connectionWriter.cxx.
References Datagram::get_length(), Connection::get_socket(), DatagramQueue::insert(), TypedObject::is_exact_type(), NetDatagram::set_address(), and NetDatagram::set_connection().
| void ConnectionWriter::set_max_queue_size |
( |
int |
max_size | ) |
|
| void ConnectionWriter::set_raw_mode |
( |
bool |
mode | ) |
|
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.
Definition at line 294 of file connectionWriter.cxx.
| void ConnectionWriter::set_tcp_header_size |
( |
int |
tcp_header_size | ) |
|
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.
Definition at line 319 of file connectionWriter.cxx.
| void ConnectionWriter::shutdown |
( |
| ) |
|
The documentation for this class was generated from the following files:
| | |