Panda3D
Public Member Functions | List of all members
DatagramSinkNet Class Reference

This class accepts datagrams one-at-a-time and sends them over the net, via a TCP connection. More...

Inheritance diagram for DatagramSinkNet:
DatagramSink ConnectionWriter

Public Member Functions

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

Additional Inherited Members

- Public Attributes inherited from DatagramSink
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. More...
 
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. More...
 
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. More...
 

Detailed Description

This class accepts datagrams one-at-a-time and sends them over the net, via a TCP connection.

Member Function Documentation

◆ __init__()

__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()

flush ( )

Ensures that all datagrams previously written will be visible on the stream.

◆ getTarget()

Connection getTarget ( )

Returns the current target Connection, or NULL if the target has not yet been set.

See set_target().

◆ isError()

bool isError ( )

Returns true if there is an error on the target connection, or if the target has never been set.

◆ putDatagram()

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()

setTarget ( Connection  connection)

Specifies the Connection that will receive all future Datagrams sent.