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
15
16TypeHandle Buffered_DatagramConnection::_type_handle;
17
18/**
19 * send the message
20 */
22SendMessage(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}
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool SendMessage(const Datagram &msg)
send the message
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition datagram.h:38
size_t get_length() const
Returns the number of bytes in the datagram.
Definition datagram.I:335
const void * get_data() const
Returns a pointer to the beginning of the datagram's data.
Definition datagram.I:327
size_t AmountBuffered(void)
Will report the number of unread chars in buffer.
Definition ringbuffer.I:32
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81