class DatagramSinkNet

Bases: DatagramSink, ConnectionWriter

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

Inheritance diagram

Inheritance diagram of DatagramSinkNet

explicit 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.

virtual void flush(void)

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

Connection *get_target(void) const

Returns the current target Connection, or NULL if the target has not yet been set. See set_target().

virtual bool is_error(void)

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

virtual bool put_datagram(Datagram const &data)

Inherited from DatagramSink

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.

void set_target(Connection *connection)

Specifies the Connection that will receive all future Datagrams sent.