# QueuedConnectionManager

from pandac.PandaModules import QueuedConnectionManager

Class : QueuedConnectionManager
Description : This flavor of ConnectionManager will queue up all of the reset-connection messages from the ConnectionReaders and ConnectionWriters and report them to the client on demand.
When a reset connection has been discovered via reset_connection_available()/get_reset_connection(), it is still the responsibility of the client to call close_connection() on that connection to free up its resources.

## Inheritance:

QueuedConnectionManager: ConnectionManager QueuedReturn< PointerTo< Connection > >
ConnectionManager:
QueuedReturn< PointerTo< Connection > >:

## Methods of QueuedConnectionManager:

getResetConnection
resetConnectionAvailable

## Methods of ConnectionManager:

closeConnection
getHostName
openTCPClientConnection
openTCPServerRendezvous
openUDPConnection

## Methods of QueuedReturn< PointerTo< Connection > >:

getCurrentQueueSize
getMaxQueueSize
getOverflowFlag
resetOverflowFlag
setMaxQueueSize

getResetConnection bool QueuedConnectionManager::get_reset_connection(PointerTo< Connection > &connection); Description: If a previous call to reset_connection_available() returned true, this function will return information about the newly reset connection. Only connections which were externally reset are certain to appear in this list. Those which were explicitly closed via a call to close_connection() may or may not be reported. Furthermore, it is the responsibility of the caller to subsequently call close_connection() with any connection reported reset by this call. (There is no harm in calling close_connection() more than once on a given socket.) The return value is true if a connection was successfully returned, or false if there was, in fact, no reset connection. (This may happen if there are multiple threads accessing the QueuedConnectionManager).

resetConnectionAvailable bool QueuedConnectionManager::reset_connection_available(void) const; Description: Returns true if one of the readers/writers/listeners reported a connection reset recently. If so, the particular connection that has been reset can be extracted via get_reset_connection(). Only connections which were externally reset are certain to appear in this list. Those which were explicitly closed via a call to close_connection() may or may not be reported. Furthermore, it is the responsibility of the caller to subsequently call close_connection() with any connection reported reset by this call. (There is no harm in calling close_connection() more than once on a given socket.)

closeConnection bool ConnectionManager::close_connection(PointerTo< Connection > const &connection); Description: Terminates a UDP or TCP socket previously opened. This also removes it from any associated ConnectionReader or ConnectionListeners. The socket itself may not be immediately closed--it will not be closed until all outstanding pointers to it are cleared, including any pointers remaining in NetDatagrams recently received from the socket. The return value is true if the connection was marked to be closed, or false if close_connection() had already been called (or the connection did not belong to this ConnectionManager). In neither case can you infer anything about whether the connection has *actually* been closed yet based on the return value.

getHostName static string ConnectionManager::get_host_name(void); Description: Returns the name of this particular machine on the network, if available, or the empty string if the hostname cannot be determined.

openTCPClientConnection PointerTo< Connection > ConnectionManager::open_TCP_client_connection(NetAddress const &address, int timeout_ms); Description: Attempts to establish a TCP client connection to a server at the indicated address. If the connection is not established within timeout_ms milliseconds, a null connection is returned. Description: This is a shorthand version of the function to directly establish communcations to a named host and port.

openTCPServerRendezvous PointerTo< Connection > ConnectionManager::open_TCP_server_rendezvous(int port, int backlog); Description: Creates a socket to be used as a rendezvous socket for a server to listen for TCP connections. The socket returned by this call should only be added to a ConnectionListener (not to a generic ConnectionReader). backlog is the maximum length of the queue of pending connections.

openUDPConnection PointerTo< Connection > ConnectionManager::open_UDP_connection(int port = (0)); Description: Opens a socket for sending and/or receiving UDP packets. If the port number is negative, it will not be bound to a socket; this is generally a pointless thing to do. If the port number is zero, a random socket will be chosen. Otherwise, the specified port number is used. Normally, you don't care what port a UDP connection is opened on, so you should use the default value of zero. Use a ConnectionReader and ConnectionWriter to handle the actual communication.

getCurrentQueueSize int ::QueuedReturn< PointerTo< Connection > >::get_current_queue_size(void) const; Undocumented function.

getMaxQueueSize int ::QueuedReturn< PointerTo< Connection > >::get_max_queue_size(void) const; Undocumented function.

getOverflowFlag bool ::QueuedReturn< PointerTo< Connection > >::get_overflow_flag(void) const; Undocumented function.

resetOverflowFlag void ::QueuedReturn< PointerTo< Connection > >::reset_overflow_flag(void); Undocumented function.

setMaxQueueSize void ::QueuedReturn< PointerTo< Connection > >::set_max_queue_size(int max_size); Undocumented function.