Panda3D

Loading...
Searching...
No Matches
buffered_datagramconnection.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file buffered_datagramconnection.cxx
10 * @author drose
11 * @date 2007-03-05
12 */
13
14#include "buffered_datagramconnection.h"
15
16 TypeHandle Buffered_DatagramConnection::_type_handle;
17
18/**
19 * send the message
20 */
21 bool Buffered_DatagramConnection::
22 SendMessage(const Datagram &msg) {
23 if (IsConnected()) {
24 // printf(" DO SendMessage %d\n",msg.get_length());
25
26 int val = _Writer.AddData(msg.get_data(), msg.get_length(), *this);
27 if (val >= 0) {
28 return true;
29 }
30
31 // Raise an exception to give us more information at the python level
32 nativenet_cat.warning() << "Buffered_DatagramConnection::SendMessage->Error On Write--Out Buffer = " << _Writer.AmountBuffered() << "\n";
33
34 ClearAll();
35 }
36
37 return false;
38}
buffered_datagramconnection.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Buffered_DatagramConnection::SendMessage
bool SendMessage(const Datagram &msg)
send the message
Definition buffered_datagramconnection.cxx:22
Datagram
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition datagram.h:38
Datagram::get_length
size_t get_length() const
Returns the number of bytes in the datagram.
Definition datagram.I:335
Datagram::get_data
const void * get_data() const
Returns a pointer to the beginning of the datagram's data.
Definition datagram.I:327
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81