14#ifndef CONNECTIONWRITER_H
15#define CONNECTIONWRITER_H
38 const std::string &thread_name = std::string());
46 const PT(Connection) &connection,
50 const PT(Connection) &connection,
72 void thread_run(
int thread_index);
76 ConnectionManager *_manager;
84 class WriterThread :
public Thread {
88 virtual void thread_main();
94 typedef pvector< PT(WriterThread) > Threads;
99 friend class ConnectionManager;
100 friend class WriterThread;
The primary interface to the low-level networking layer in this package.
void set_max_queue_size(int max_size)
Limits the number of packets that may be pending on the outbound queue.
int get_num_threads() const
Returns the number of threads the ConnectionWriter has been created with.
bool send(const Datagram &datagram, const PT(Connection) &connection, bool block=false)
Enqueues a datagram for transmittal on the indicated socket.
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.
void set_raw_mode(bool mode)
Sets the ConnectionWriter into raw mode (or turns off raw mode).
void shutdown()
Stops all the threads and cleans them up.
int get_max_queue_size() const
Returns the maximum size the queue is allowed to grow to.
bool is_immediate() const
Returns true if the writer is an immediate writer, i.e.
ConnectionManager * get_manager() const
Returns a pointer to the ConnectionManager object that serves this ConnectionWriter.
bool get_raw_mode() const
Returns the current setting of the raw mode flag.
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.
int get_current_queue_size() const
Returns the current number of things in the queue.
int get_tcp_header_size() const
Returns the current setting of TCP header size.
void set_tcp_header_size(int tcp_header_size)
Sets the header size of TCP packets.
A thread-safe, FIFO queue of NetDatagrams.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Represents a network address to which UDP packets may be sent or to which a TCP socket may be bound.
A specific kind of Datagram, especially for sending across or receiving from a network.
A thread; that is, a lightweight process.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.