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

This class provides datagrams one-at-a-time as read directly from the net, via a TCP connection. More...

Inheritance diagram for DatagramGeneratorNet:
DatagramGenerator ConnectionReader QueuedReturnDatagram

Public Member Functions

 __init__ (ConnectionManager manager, int num_threads)
 Creates a new DatagramGeneratorNet with the indicated number of threads to handle requests. More...
 
bool getDatagram (Datagram data)
 Reads the next datagram from the stream. More...
 
bool isEof ()
 Returns true if the stream has been closed normally. More...
 
bool isError ()
 Returns true if the stream has an error condition. More...
 
- Public Member Functions inherited from DatagramGenerator
bool getDatagram (Datagram data)
 
const FileReference getFile ()
 Returns the FileReference that provides the source for these datagrams, if any, or NULL if the datagrams do not originate from a file on disk. More...
 
const Filename getFilename ()
 Returns the filename that provides the source for these datagrams, if any, or empty string if the datagrams do not originate from 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...
 
time_t getTimestamp ()
 Returns the on-disk timestamp of the file that was read, at the time it was opened, if that is available, or 0 if it is not. More...
 
VirtualFile getVfile ()
 Returns the VirtualFile that provides the source for these datagrams, if any, or NULL if the datagrams do not originate from a VirtualFile. More...
 
bool isEof ()
 
bool isError ()
 
bool saveDatagram (SubfileInfo info)
 Skips over the next datagram without extracting it, but saves the relevant file information in the SubfileInfo object so that its data may be read later. More...
 
- Public Member Functions inherited from ConnectionReader
bool addConnection (Connection connection)
 Adds a new socket to the list of sockets the ConnectionReader will monitor. More...
 
ConnectionManager getManager ()
 Returns a pointer to the ConnectionManager object that serves this ConnectionReader. More...
 
int getNumThreads ()
 Returns the number of threads the ConnectionReader 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 isConnectionOk (Connection connection)
 Returns true if the indicated connection has been added to the ConnectionReader and is being monitored properly, false if it is not known, or if there was some error condition detected on the connection. More...
 
bool isPolling ()
 Returns true if the reader is a polling reader, i.e. More...
 
 poll ()
 Explicitly polls the available sockets to see if any of them have any noise. More...
 
bool removeConnection (Connection connection)
 Removes a socket from the list of sockets being monitored. More...
 
 setRawMode (bool mode)
 Sets the ConnectionReader into raw mode (or turns off raw mode). More...
 
 setTcpHeaderSize (int tcp_header_size)
 Sets the header size of TCP packets. More...
 
 shutdown ()
 Terminates all threads cleanly. More...
 
- Public Member Functions inherited from QueuedReturnDatagram
int getCurrentQueueSize ()
 
int getMaxQueueSize ()
 
bool getOverflowFlag ()
 
 resetOverflowFlag ()
 
 setMaxQueueSize (int max_size)
 

Detailed Description

This class provides datagrams one-at-a-time as read directly from the net, via a TCP connection.

If a datagram is not available, get_datagram() will block until one is.

Member Function Documentation

◆ __init__()

__init__ ( ConnectionManager  manager,
int  num_threads 
)

Creates a new DatagramGeneratorNet with the indicated number of threads to handle requests.

Normally num_threads should be either 0 or 1 to guarantee that datagrams are generated in the same order in which they were received.

◆ getDatagram()

bool getDatagram ( Datagram  data)

Reads the next datagram from the stream.

Blocks until a datagram is available. Returns true on success, false on stream closed or error.

◆ isEof()

bool isEof ( )

Returns true if the stream has been closed normally.

This test may only be made after a call to get_datagram() has failed.

◆ isError()

bool isError ( )

Returns true if the stream has an error condition.