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

This flavor of ConnectionListener will queue up all of the TCP connections it established for later detection by the client code. More...

Inheritance diagram for QueuedConnectionListener:
ConnectionListener QueuedReturnConnectionListenerData ConnectionReader

Public Member Functions

 __init__ (ConnectionManager manager, int num_threads)
 
bool getNewConnection (PointerToConnection new_connection)
 This flavor of get_new_connection() simply returns a new connection, assuming the user doesn't care about the rendezvous socket that originated it or the address it came from. More...
 
bool getNewConnection (PointerToConnection rendezvous, NetAddress address, PointerToConnection new_connection)
 If a previous call to new_connection_available() returned true, this function will return information about the newly established connection. More...
 
bool newConnectionAvailable ()
 Returns true if a new connection was recently established; the connection information may then be retrieved via get_new_connection(). 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 QueuedReturnConnectionListenerData
int getCurrentQueueSize ()
 
int getMaxQueueSize ()
 
bool getOverflowFlag ()
 
 resetOverflowFlag ()
 
 setMaxQueueSize (int max_size)
 

Detailed Description

This flavor of ConnectionListener will queue up all of the TCP connections it established for later detection by the client code.

Member Function Documentation

◆ __init__()

__init__ ( ConnectionManager  manager,
int  num_threads 
)

◆ getNewConnection() [1/2]

bool getNewConnection ( PointerToConnection  new_connection)

This flavor of get_new_connection() simply returns a new connection, assuming the user doesn't care about the rendezvous socket that originated it or the address it came from.

◆ getNewConnection() [2/2]

bool getNewConnection ( PointerToConnection  rendezvous,
NetAddress  address,
PointerToConnection  new_connection 
)

If a previous call to new_connection_available() returned true, this function will return information about the newly established connection.

The rendezvous parameter is the particular rendezvous socket this new connection originally communicated with; it is provided in case the ConnectionListener was monitorind more than one and you care which one it was. The address parameter is the net address of the new client, and new_connection is the socket of the newly established connection.

The return value is true if a connection was successfully returned, or false if there was, in fact, no new connection. (This may happen if there are multiple threads accessing the QueuedConnectionListener).

◆ newConnectionAvailable()

bool newConnectionAvailable ( )

Returns true if a new connection was recently established; the connection information may then be retrieved via get_new_connection().