Poco::UPnP::SSDP

class HTTPMUClient

File Information

Library: UPnP/SSDP
Package: HTTPMU
Header: Poco/UPnP/SSDP/HTTPMUClient.h

Description

HTTPMUClient is used to send HTTPMU messages (requests and responses) to other hosts or multicast groups.

The specification for HTTPMU can be found in the (expired) Internet Draft "Multicast and Unicast UDP HTTP Messages" <http://tools.ietf.org/id/draft-goland-http-udp-00.txt>.

Note that HTTPMU does not support request-reply messages in the same way as HTTP. All HTTPMU messages are one-way. The correlation between requests and replies must be implemented by an application specific mechanism. If a client wants to receive a response message from a server, it has to set up its own HTTPMUServer instance.

Note that the client supports a maximum message size (defined by MAX_MESSAGE_SIZE). Actual message size should be smaller to avoid packet fragmentation, which decreases performance and increases the probability of packet loss.

Member Summary

Member Functions: sendMessage, sendRequest, sendResponse

Enumerations

Anonymous

MAX_MESSAGE_SIZE = 4096

Constructors

HTTPMUClient

HTTPMUClient(
    const Poco::Net::DatagramSocket & socket
);

Creates the HTTPMUClient, using the given socket.

For sending multicast messages, a Poco::Net::MulticastSocket must be given.

Destructor

~HTTPMUClient

~HTTPMUClient();

Destroys the HTTPMUClient.

Member Functions

sendRequest

void sendRequest(
    const Poco::Net::SocketAddress & destinationAddress,
    Poco::Net::HTTPRequest & request
);

Sends the given request to the host (or multicast group) given by destinationAddress.

A Host header will be added to the request if none has been set.

sendRequest

void sendRequest(
    const Poco::Net::SocketAddress & destinationAddress,
    Poco::Net::HTTPRequest & request,
    const std::string & requestBody
);

Sends the given request to the host (or multicast group) given by destinationAddress.

A Host header will be added to the request if none has been set.

The given requestBody can be empty. If a non-empty requestBody is given, the request's content length field should be set accordingly.

sendResponse

void sendResponse(
    const Poco::Net::SocketAddress & destinationAddress,
    Poco::Net::HTTPResponse & response
);

Sends the given response to the host (or multicast group) given by destinationAddress.

A Date header will be added to the response if none has been set.

sendResponse

void sendResponse(
    const Poco::Net::SocketAddress & destinationAddress,
    Poco::Net::HTTPResponse & response,
    const std::string & responseBody
);

Sends the given response to the host (or multicast group) given by destinationAddress.

A Date header will be added to the response if none has been set.

The given responseBody can be empty. If a non-empty responseBody is given, the response's content length field should be set accordingly.

sendMessage protected

void sendMessage(
    const Poco::Net::SocketAddress & destinationAddress,
    const Poco::Net::HTTPMessage & message,
    const std::string & messageBody
);

Securely control IoT edge devices from anywhere   Connect a Device