Panda3D
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
ConnectionManager Class Referenceabstract

The primary interface to the low-level networking layer in this package. More...

#include "connectionManager.h"

Inheritance diagram for ConnectionManager:
PStatServer QueuedConnectionManager TextStats WinStatsServer

Classes

class  Interface
 

Public Member Functions

const Interfaceget_interface (size_t n)
 
size_t get_num_interfaces ()
 
 PT (Connection) open_UDP_connection(uint16_t port=0)
 
 PT (Connection) open_TCP_client_connection(const NetAddress &address
 
void scan_interfaces ()
 Repopulates the list reported by get_num_interface()/get_interface(). More...
 
bool wait_for_readers (double timeout)
 Blocks the process for timeout number of seconds, or until any data is available on any of the non-threaded ConnectionReaders or ConnectionListeners, whichever comes first. More...
 

Static Public Member Functions

static std::string get_host_name ()
 

Public Attributes

PT(Connection) open_UDP_connection(const std int backlog
 
PT(Connection) open_TCP_server_rendezvous(const std int backlog
 
 get_host_name
 Returns the name of this particular machine on the network, if available, or the empty string if the hostname cannot be determined. More...
 
 get_interface
 Returns the nth usable network interface detected on this machine. More...
 
 get_num_interfaces
 This returns the number of usable network interfaces detected on this machine. More...
 
int timeout_ms
 

Friends

class Connection
 
class ConnectionListener
 
class ConnectionReader
 
class ConnectionWriter
 

Detailed Description

The primary interface to the low-level networking layer in this package.

A ConnectionManager is used to establish and destroy TCP and UDP connections. Communication on these connections, once established, is handled via ConnectionReader, ConnectionWriter, and ConnectionListener.

You may use this class directly if you don't care about tracking which connections have been unexpectedly closed; otherwise, you should use QueuedConnectionManager to get reports about these events (or derive your own class to handle these events properly).

Definition at line 41 of file connectionManager.h.

Member Function Documentation

◆ scan_interfaces()

void ConnectionManager::scan_interfaces ( )

Repopulates the list reported by get_num_interface()/get_interface().

It is not necessary to call this explicitly, unless you want to re-determine the connected interfaces (for instance, if you suspect the hardware has recently changed).

Definition at line 476 of file connectionManager.cxx.

◆ wait_for_readers()

bool ConnectionManager::wait_for_readers ( double  timeout)

Blocks the process for timeout number of seconds, or until any data is available on any of the non-threaded ConnectionReaders or ConnectionListeners, whichever comes first.

The return value is true if there is data available (but you have to iterate through all readers to find it), or false if the timeout occurred without any data.

If the timeout value is negative, this will block forever or until data is available.

This only works if all ConnectionReaders and ConnectionListeners are non- threaded. If any threaded ConnectionReaders are part of the ConnectionManager, the timeout value is implicitly treated as 0.

Definition at line 383 of file connectionManager.cxx.

References Socket_fdset::clear(), TrueClock::get_global_ptr(), and ConnectionReader::is_polling().

Member Data Documentation

◆ get_host_name

string ConnectionManager::get_host_name

Returns the name of this particular machine on the network, if available, or the empty string if the hostname cannot be determined.

Definition at line 111 of file connectionManager.h.

◆ get_interface

const ConnectionManager::Interface & ConnectionManager::get_interface

Returns the nth usable network interface detected on this machine.

See scan_interfaces() to repopulate this list.

Definition at line 109 of file connectionManager.h.

◆ get_num_interfaces

size_t ConnectionManager::get_num_interfaces

This returns the number of usable network interfaces detected on this machine.

See scan_interfaces() to repopulate this list.

Definition at line 109 of file connectionManager.h.


The documentation for this class was generated from the following files: