# CConnectionRepository

from pandac.PandaModules import CConnectionRepository

Class : CConnectionRepository
Description : This class implements the C++ side of the ConnectionRepository object. In particular, it manages the connection to the server once it has been opened (but does not open it directly). It manages reading and writing datagrams on the connection and monitoring for unexpected disconnects as well as handling intentional disconnects.
Certain server messages, like field updates, are handled entirely within the C++ layer, while server messages that are not understood by the C++ layer are returned up to the Python layer for processing.

## Inheritance:

CConnectionRepository:

## Methods of CConnectionRepository:

CConnectionRepository (Constructor)
abandonMessageBundles
bundleMsg
checkDatagram
considerFlush
disconnect
flush
getClientDatagram
getCw
getDatagram
getDatagramIterator
getDcFile
getHandleCUpdates
getMsgChannel
getMsgChannelCount
getMsgSender
getMsgType
getOverflowEventName
getQcm
getQcr
getSimulatedDisconnect
getStream
getVerbose
getWantMessageBundling
hasOwnerView
isBundlingMessages
isConnected
sendDatagram
sendMessageBundle
setClientDatagram
setConnectionHttp
setHandleCUpdates
setPythonRepository
setSimulatedDisconnect
setVerbose
setWantMessageBundling
startMessageBundle
toggleVerbose
tryConnectNet

CConnectionRepository CConnectionRepository::CConnectionRepository(bool has_owner_view = (0)); Description:

abandonMessageBundles void CConnectionRepository::abandon_message_bundles(void); Description: throw out any msgs that have been queued up for message bundles

bundleMsg void CConnectionRepository::bundle_msg(Datagram const &dg); Description:

checkDatagram bool CConnectionRepository::check_datagram(void); Description: Returns true if a new datagram is available, false otherwise. If the return value is true, the new datagram may be retrieved via get_datagram(), or preferably, with get_datagram_iterator() and get_msg_type().

considerFlush bool CConnectionRepository::consider_flush(void); Description: Sends the most recently queued data if enough time has elapsed. This only has meaning if set_collect_tcp() has been set to true.

disconnect void CConnectionRepository::disconnect(void); Description: Closes the connection to the server.

flush bool CConnectionRepository::flush(void); Description: Sends the most recently queued data now. This only has meaning if set_collect_tcp() has been set to true.

getClientDatagram bool CConnectionRepository::get_client_datagram(void) const; Description: Returns the client_datagram flag.

getCw ConnectionWriter &CConnectionRepository::get_cw(void); Description: Returns the ConnectionWriter object associated with the repository.

getDatagram void CConnectionRepository::get_datagram(Datagram &dg); Description: Fills the datagram object with the datagram most recently retrieved by check_datagram().

getDatagramIterator void CConnectionRepository::get_datagram_iterator(DatagramIterator &di); Description: Fills the DatagramIterator object with the iterator for the datagram most recently retrieved by check_datagram(). This iterator has already read past the datagram header and the message type, and is positioned at the beginning of data.

getDcFile DCFile &CConnectionRepository::get_dc_file(void); Description: Returns the DCFile object associated with this repository.

getHandleCUpdates bool CConnectionRepository::get_handle_c_updates(void) const; Description: Returns true if this repository will process distributed updates internally in C++ code, or false if it will return them to Python.

getMsgChannel unsigned long int CConnectionRepository::get_msg_channel(int offset = (0)) const; Description: Returns the channel from which the current message was sent, according to the datagram headers. This information is not available to the client.

getMsgChannelCount int CConnectionRepository::get_msg_channel_count(void) const; Undocumented function.

getMsgSender unsigned long int CConnectionRepository::get_msg_sender(void) const; Description: Returns the sender ID of the current message, according to the datagram headers. This information is not available to the client.

getMsgType unsigned int CConnectionRepository::get_msg_type(void) const; INLINE unsigned char get_sec_code() const; Description: Returns the security code associated with the current message, according to the datagram headers. This information is not available to the client. INLINE unsigned char CConnectionRepository:: get_sec_code() const { return _sec_code; } Description: Returns the type ID of the current message, according to the datagram headers.

getOverflowEventName static string const &CConnectionRepository::get_overflow_event_name(void); Description: Returns event string that will be thrown if the datagram reader queue overflows.

getQcm QueuedConnectionManager &CConnectionRepository::get_qcm(void); Description: Returns the QueuedConnectionManager object associated with the repository.

getQcr QueuedConnectionReader &CConnectionRepository::get_qcr(void); Description: Returns the QueuedConnectionReader object associated with the repository.

getSimulatedDisconnect bool CConnectionRepository::get_simulated_disconnect(void) const; Description: Returns the simulated disconnect flag. While this is true, no datagrams will be retrieved from or sent to the server. The idea is to simulate a temporary network outage.

getStream SocketStream *CConnectionRepository::get_stream(void); Description: Returns the SocketStream that internally represents the already-established HTTP connection. Returns NULL if there is no current HTTP connection.

getVerbose bool CConnectionRepository::get_verbose(void) const; Description: Returns the current setting of the verbose flag. When true, this describes every message going back and forth on the wire.

getWantMessageBundling bool CConnectionRepository::get_want_message_bundling(void) const; Description: Returns true if message bundling enabled

hasOwnerView bool CConnectionRepository::has_owner_view(void) const; Description: Returns true if this repository can have 'owner' views of distributed objects.

isBundlingMessages bool CConnectionRepository::is_bundling_messages(void) const; Description: Returns true if repository is queueing outgoing messages into a message bundle

isConnected bool CConnectionRepository::is_connected(void); Description: Returns true if the connection to the gameserver is established and still good, false if we are not connected. A false value means either (a) we never successfully connected, (b) we explicitly called disconnect(), or (c) we were connected, but the connection was spontaneously lost.

sendDatagram bool CConnectionRepository::send_datagram(Datagram const &dg); Description: Queues the indicated datagram for sending to the server. It may not get sent immediately if collect_tcp is in effect; call flush() to guarantee it is sent now.

sendMessageBundle void CConnectionRepository::send_message_bundle(unsigned int channel, unsigned int sender_channel); Description: Send network messages queued up since startMessageBundle was called.

setClientDatagram void CConnectionRepository::set_client_datagram(bool client_datagram); Description: Sets the client_datagram flag. If this is true, incoming datagrams are not expected to be prefixed with the server routing information like message sender, channel number, etc.; otherwise, these server fields are parsed and removed from each incoming datagram.

setConnectionHttp void CConnectionRepository::set_connection_http(HTTPChannel *channel); Description: Once a connection has been established via the HTTP interface, gets the connection and uses it. The supplied HTTPChannel object must have a connection available via get_connection().

setHandleCUpdates void CConnectionRepository::set_handle_c_updates(bool handle_c_updates); Description: Set true to specify this repository should process distributed updates internally in C++ code, or false if it should return them to Python.

setPythonRepository void CConnectionRepository::set_python_repository(PyObject *python_repository); Description: Records the pointer to the Python class that derives from CConnectionRepository. This allows the C++ implementation to directly manipulation some python structures on the repository.

setSimulatedDisconnect void CConnectionRepository::set_simulated_disconnect(bool simulated_disconnect); Description: Sets the simulated disconnect flag. While this is true, no datagrams will be retrieved from or sent to the server. The idea is to simulate a temporary network outage.

setVerbose void CConnectionRepository::set_verbose(bool verbose); Description: Directly sets the verbose flag. When true, this describes every message going back and forth on the wire.

setWantMessageBundling void CConnectionRepository::set_want_message_bundling(bool flag); Description: Enable/disable outbound message bundling

startMessageBundle void CConnectionRepository::start_message_bundle(void); Description: Send a set of messages to the state server that will be processed atomically. For instance, you can do a combined setLocation/setPos and prevent race conditions where clients briefly get the setLocation but not the setPos, because the state server hasn't processed the setPos yet

toggleVerbose void CConnectionRepository::toggle_verbose(void); Description: Toggles the current setting of the verbose flag. When true, this describes every message going back and forth on the wire.

tryConnectNet bool CConnectionRepository::try_connect_net(URLSpec const &url); Description: Uses Panda's "net" library to try to connect to the server and port named in the indicated URL. Returns true if successful, false otherwise.