Public Member Functions
Dashel::PacketStream Class Reference

A data stream, that can be later send data as at UDP packet or read data from an UDP packet. More...

#include <dashel.h>

Inheritance diagram for Dashel::PacketStream:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 PacketStream (const std::string &protocolName)
 Constructor.
virtual void receive (IPV4Address &source)=0
 Receive a packet and make its payload available for reading.
virtual void send (const IPV4Address &dest)=0
 Send all written data to an IP address in a single packet.

Detailed Description

A data stream, that can be later send data as at UDP packet or read data from an UDP packet.

You can use PacketStream to write and read data as with normal stream, with the difference that: written byte will be collected in a send buffer until send() is called with the destination address; if you have written too much byte for send to transmit all of them an exception will occur. However, the underlying operating system may pretend that all data has been transmitted while discarding some of it anyway. In any case, send less bytes than ethernet MTU minus UDP header. you have to call receive() when there are bytes available on the stream to be able to read them; if your read past the received bytes an exception will occur.

Definition at line 379 of file dashel.h.


Constructor & Destructor Documentation

Dashel::PacketStream::PacketStream ( const std::string &  protocolName) [inline]

Constructor.

Definition at line 383 of file dashel.h.


Member Function Documentation

virtual void Dashel::PacketStream::receive ( IPV4Address source) [pure virtual]

Receive a packet and make its payload available for reading.

Block until a packet is available.

Parameters:
sourceIP address from where the packet originates.

Implemented in Dashel::UDPSocketStream, and Dashel::UDPSocketStream.

virtual void Dashel::PacketStream::send ( const IPV4Address dest) [pure virtual]

Send all written data to an IP address in a single packet.

Parameters:
destIP address to send packet to

Implemented in Dashel::UDPSocketStream, and Dashel::UDPSocketStream.


The documentation for this class was generated from the following file:


dashel
Author(s): Stéphane Magnenat
autogenerated on Sun Oct 5 2014 23:46:32