ConnectionWriter
from panda3d.net import ConnectionWriter
- class ConnectionWriter
Bases:
DTOOL_SUPER_BASE
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.
Inheritance diagram
- __init__(*args, **kwargs)
- getCurrentQueueSize()
C++ Interface: get_current_queue_size(ConnectionWriter self)
- /**
Returns the current number of things in the queue.
*/
- getManager()
C++ Interface: get_manager(ConnectionWriter self)
- /**
Returns a pointer to the ConnectionManager object that serves this
ConnectionWriter.
*/
- getMaxQueueSize()
C++ Interface: get_max_queue_size(ConnectionWriter self)
- /**
Returns the maximum size the queue is allowed to grow to. See
set_max_queue_size().
*/
- getNumThreads()
C++ Interface: get_num_threads(ConnectionWriter self)
- /**
Returns the number of threads the ConnectionWriter has been created with.
*/
- getRawMode()
C++ Interface: get_raw_mode(ConnectionWriter self)
- /**
Returns the current setting of the raw mode flag. See set_raw_mode().
*/
- getTcpHeaderSize()
C++ Interface: get_tcp_header_size(ConnectionWriter self)
- /**
Returns the current setting of TCP header size. See set_tcp_header_size().
*/
- get_current_queue_size()
C++ Interface: get_current_queue_size(ConnectionWriter self)
- /**
Returns the current number of things in the queue.
*/
- get_manager()
C++ Interface: get_manager(ConnectionWriter self)
- /**
Returns a pointer to the ConnectionManager object that serves this
ConnectionWriter.
*/
- get_max_queue_size()
C++ Interface: get_max_queue_size(ConnectionWriter self)
- /**
Returns the maximum size the queue is allowed to grow to. See
set_max_queue_size().
*/
- get_num_threads()
C++ Interface: get_num_threads(ConnectionWriter self)
- /**
Returns the number of threads the ConnectionWriter has been created with.
*/
- get_raw_mode()
C++ Interface: get_raw_mode(ConnectionWriter self)
- /**
Returns the current setting of the raw mode flag. See set_raw_mode().
*/
- get_tcp_header_size()
C++ Interface: get_tcp_header_size(ConnectionWriter self)
- /**
Returns the current setting of TCP header size. See set_tcp_header_size().
*/
- isImmediate()
C++ Interface: is_immediate(ConnectionWriter self)
- /**
Returns true if the writer is an immediate writer, i.e. it has no threads.
*/
- isValidForUdp()
C++ Interface: is_valid_for_udp(ConnectionWriter self, const Datagram datagram)
- /**
Returns true if the datagram is small enough to be sent over a UDP packet,
false otherwise.
*/
- is_immediate()
C++ Interface: is_immediate(ConnectionWriter self)
- /**
Returns true if the writer is an immediate writer, i.e. it has no threads.
*/
- is_valid_for_udp()
C++ Interface: is_valid_for_udp(ConnectionWriter self, const Datagram datagram)
- /**
Returns true if the datagram is small enough to be sent over a UDP packet,
false otherwise.
*/
- send()
C++ Interface: send(const ConnectionWriter self, const Datagram datagram, const Connection connection) send(const ConnectionWriter self, const Datagram datagram, const Connection connection, const NetAddress address, bool block) send(const ConnectionWriter self, const Datagram datagram, const Connection connection, bool block)
- /**
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.
*/
- /**
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.
*/
- setMaxQueueSize()
C++ Interface: set_max_queue_size(const ConnectionWriter self, int max_size)
- /**
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()
C++ Interface: set_raw_mode(const ConnectionWriter self, 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.
*/
- setTcpHeaderSize()
C++ Interface: set_tcp_header_size(const ConnectionWriter self, 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.
*/
- set_max_queue_size()
C++ Interface: set_max_queue_size(const ConnectionWriter self, int max_size)
- /**
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.
*/
- set_raw_mode()
C++ Interface: set_raw_mode(const ConnectionWriter self, 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.
*/
- set_tcp_header_size()
C++ Interface: set_tcp_header_size(const ConnectionWriter self, 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.
*/