Panda3D
Public Member Functions
DatagramSinkNet Class Reference

This class accepts datagrams one-at-a-time and sends them over the net, via a TCP connection. More...

#include "datagramSinkNet.h"

Inheritance diagram for DatagramSinkNet:
DatagramSink ConnectionWriter

List of all members.

Public Member Functions

 DatagramSinkNet (ConnectionManager *manager, int num_threads)
 Creates a new DatagramSinkNet with the indicated number of threads to handle writing.
virtual void flush ()
 Ensures that all datagrams previously written will be visible on the stream.
Connectionget_target () const
 Returns the current target Connection, or NULL if the target has not yet been set.
virtual bool is_error ()
 Returns true if there is an error on the target connection, or if the target has never been set.
virtual bool put_datagram (const Datagram &data)
 Sends the given datagram to the target.
void set_target (Connection *connection)
 Specifies the Connection that will receive all future Datagrams sent.

Detailed Description

This class accepts datagrams one-at-a-time and sends them over the net, via a TCP connection.

Definition at line 28 of file datagramSinkNet.h.


Constructor & Destructor Documentation

DatagramSinkNet::DatagramSinkNet ( ConnectionManager manager,
int  num_threads 
)

Creates a new DatagramSinkNet with the indicated number of threads to handle writing.

Normally num_threads should be either 0 or 1 to guarantee that datagrams are delivered in the same order in which they were sent.

Definition at line 29 of file datagramSinkNet.cxx.


Member Function Documentation

void DatagramSinkNet::flush ( void  ) [virtual]

Ensures that all datagrams previously written will be visible on the stream.

Implements DatagramSink.

Definition at line 67 of file datagramSinkNet.cxx.

Returns the current target Connection, or NULL if the target has not yet been set.

See set_target().

Definition at line 34 of file datagramSinkNet.I.

bool DatagramSinkNet::is_error ( ) [virtual]

Returns true if there is an error on the target connection, or if the target has never been set.

Implements DatagramSink.

Definition at line 56 of file datagramSinkNet.cxx.

bool DatagramSinkNet::put_datagram ( const Datagram data) [virtual]

Sends the given datagram to the target.

Returns true on success, false if there is an error. Blocks if necessary until the target is ready.

Implements DatagramSink.

Definition at line 42 of file datagramSinkNet.cxx.

References ConnectionWriter::send().

void DatagramSinkNet::set_target ( Connection connection) [inline]

Specifies the Connection that will receive all future Datagrams sent.

Definition at line 23 of file datagramSinkNet.I.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations