ConnectionStream
ConnectionStream
#include <icy/http/connection.h>Inherits:
SocketAdapter
Packet stream wrapper for an HTTP connection.
Public Attributes
| Return | Name | Description |
|---|---|---|
PacketStream | Outgoing | The Outgoing stream is responsible for packetizing raw application data into the agreed upon HTTP format and sending it to the peer. |
PacketStream | Incoming | The Incoming stream emits incoming HTTP packets for processing by the application. |
ProgressSignal | IncomingProgress | Fired on download progress. |
ProgressSignal | OutgoingProgress | Fired on upload progress. |
Outgoing
PacketStream OutgoingThe Outgoing stream is responsible for packetizing raw application data into the agreed upon HTTP format and sending it to the peer.
Incoming
PacketStream IncomingThe Incoming stream emits incoming HTTP packets for processing by the application.
This is useful for example when writing incoming data to a file.
IncomingProgress
ProgressSignal IncomingProgressFired on download progress.
OutgoingProgress
ProgressSignal OutgoingProgressFired on upload progress.
Public Methods
| Return | Name | Description |
|---|---|---|
ConnectionStream | Creates a ConnectionStream wrapping the given HTTP connection. Wires the Outgoing stream emitter to the connection adapter and registers this stream to receive incoming data from the adapter. | |
ssize_t | send virtual | Send data via the Outgoing stream. |
Connection::Ptr | connection | Return a reference to the underlying connection. |
ConnectionStream
ConnectionStream(Connection::Ptr connection)Creates a ConnectionStream wrapping the given HTTP connection. Wires the Outgoing stream emitter to the connection adapter and registers this stream to receive incoming data from the adapter.
Parameters
connectionThe HTTP connection to wrap.
send
virtual
virtual ssize_t send(const char * data, size_t len, int flags)Send data via the Outgoing stream.
connection
Connection::Ptr connection()Return a reference to the underlying connection.
Protected Attributes
| Return | Name | Description |
|---|---|---|
Connection::Ptr | _connection |
_connection
Connection::Ptr _connectionProtected Methods
| Return | Name | Description |
|---|---|---|
bool | onSocketRecv virtual | Called when data is received from the socket. Forwards the event to all registered receivers in priority order. |
onSocketRecv
virtual
virtual bool onSocketRecv(net::Socket & socket, const MutableBuffer & buffer, const net::Address & peerAddress)Called when data is received from the socket. Forwards the event to all registered receivers in priority order.
Parameters
socketThe socket that received data.bufferThe received data buffer.peerAddressAddress of the sender.
Returns
true to stop propagation to subsequent receivers.
