Public Member Functions
|PacketStream (const std::string &protocolName)|
|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. |
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.
|Dashel::PacketStream::PacketStream||(||const std::string &||protocolName||)||
|virtual void Dashel::PacketStream::receive||(||IPV4Address &||source||)||
|virtual void Dashel::PacketStream::send||(||const IPV4Address &||dest||)||