class Poco::Net::HTTPServerSession

Overview

This class handles the server side of a HTTP session. More…

#include <HTTPServerSession.h>

class HTTPServerSession: public Poco::Net::HTTPSession
{
public:
    // construction

    HTTPServerSession(
        const StreamSocket& socket,
        HTTPServerParams::Ptr pParams
        );

    // methods

    bool
    hasMoreRequests();

    bool
    canKeepAlive() const;

    SocketAddress
    clientAddress();

    SocketAddress
    serverAddress();
};

Inherited Members

public:
    // enums

    enum
    {
        HTTP_PORT = 80,
    };

    // methods

    void
    setKeepAlive(bool keepAlive);

    bool
    getKeepAlive() const;

    void
    setTimeout(const Poco::Timespan& timeout);

    Poco::Timespan
    getTimeout() const;

    bool
    connected() const;

    virtual
    void
    abort();

    const Poco::Exception*
    networkException() const;

    void
    attachSessionData(const Poco::Any& data);

    const Poco::Any&
    sessionData() const;

    StreamSocket
    detachSocket();

    StreamSocket&
    socket();

    void
    drainBuffer(Poco::Buffer<char>& buffer);

protected:
    // methods

    int
    get();

    int
    peek();

    virtual
    int
    read(
        char* buffer,
        std::streamsize length
        );

    virtual
    int
    write(
        const char* buffer,
        std::streamsize length
        );

    int
    receive(
        char* buffer,
        int length
        );

    int
    buffered() const;

    void
    refill();

    virtual
    void
    connect(const SocketAddress& address);

    void
    attachSocket(const StreamSocket& socket);

    void
    close();

    void
    setException(const Poco::Exception& exc);

    void
    clearException();

Detailed Documentation

This class handles the server side of a HTTP session.

It is used internally by HTTPServer.

Construction

HTTPServerSession(
    const StreamSocket& socket,
    HTTPServerParams::Ptr pParams
    )

Creates the HTTPServerSession.

Methods

bool
hasMoreRequests()

Returns true if there are requests available.

bool
canKeepAlive() const

Returns true if the session can be kept alive.

SocketAddress
clientAddress()

Returns the client’s address.

SocketAddress
serverAddress()

Returns the server’s address.