Panda3D
|
This class accepts datagrams one-at-a-time and sends them over the net, via a TCP connection. More...
#include <pandadoc.hpp>
Public Member Functions | |
__init__ (ConnectionManager manager, int num_threads) | |
Creates a new DatagramSinkNet with the indicated number of threads to handle writing. | |
flush () | |
Ensures that all datagrams previously written will be visible on the stream. | |
Connection | getTarget () |
Returns the current target Connection, or NULL if the target has not yet been set. | |
bool | isError () |
Returns true if there is an error on the target connection, or if the target has never been set. | |
bool | putDatagram (const Datagram data) |
Sends the given datagram to the target. | |
setTarget (Connection connection) | |
Specifies the Connection that will receive all future Datagrams sent. | |
![]() | |
bool | copyDatagram (SubfileInfo result, const Filename filename) |
Copies the file data from the entire indicated file (via the vfs) as the next datagram. | |
bool | copyDatagram (SubfileInfo result, const SubfileInfo source) |
Copies the file data from the range of the indicated file (outside of the vfs) as the next datagram. | |
flush () | |
const FileReference | getFile () |
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. | |
const Filename | getFilename () |
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. | |
Streamoff | getFilePos () |
Returns the current file position within the data stream, if any, or 0 if the file position is not meaningful or cannot be determined. | |
bool | isError () |
bool | putDatagram (const Datagram data) |
![]() | |
__init__ (ConnectionManager manager, int num_threads, str thread_name) | |
Creates a new ConnectionWriter with the indicated number of threads to handle output. | |
int | getCurrentQueueSize () |
Returns the current number of things in the queue. | |
ConnectionManager | getManager () |
Returns a pointer to the ConnectionManager object that serves this ConnectionWriter. | |
int | getMaxQueueSize () |
Returns the maximum size the queue is allowed to grow to. | |
int | getNumThreads () |
Returns the number of threads the ConnectionWriter has been created with. | |
bool | getRawMode () |
Returns the current setting of the raw mode flag. | |
int | getTcpHeaderSize () |
Returns the current setting of TCP header size. | |
bool | isImmediate () |
Returns true if the writer is an immediate writer, i.e. | |
bool | isValidForUdp (const Datagram datagram) |
Returns true if the datagram is small enough to be sent over a UDP packet, false otherwise. | |
bool | send (const Datagram datagram, Connection connection, bool block) |
Enqueues a datagram for transmittal on the indicated socket. | |
bool | send (const Datagram datagram, Connection connection, const NetAddress address, bool block) |
Enqueues a datagram for transmittal on the indicated socket. | |
setMaxQueueSize (int max_size) | |
Limits the number of packets that may be pending on the outbound queue. | |
setRawMode (bool mode) | |
Sets the ConnectionWriter into raw mode (or turns off raw mode). | |
setTcpHeaderSize (int tcp_header_size) | |
Sets the header size of TCP packets. | |
shutdown () | |
Stops all the threads and cleans them up. | |
Additional Inherited Members | |
![]() | |
const FileReference | 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. | |
Streamoff | 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. | |
const Filename | 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. | |
This class accepts datagrams one-at-a-time and sends them over the net, via a TCP connection.
__init__ | ( | ConnectionManager | manager, |
int | num_threads ) |
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.
flush | ( | ) |
Ensures that all datagrams previously written will be visible on the stream.
Connection getTarget | ( | ) |
Returns the current target Connection, or NULL if the target has not yet been set.
See set_target().
bool isError | ( | ) |
Returns true if there is an error on the target connection, or if the target has never been set.
bool putDatagram | ( | const Datagram | data | ) |
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 | ( | Connection | connection | ) |
Specifies the Connection that will receive all future Datagrams sent.