class Poco::Net::SocketInputStream

Overview

An input stream for reading from a socket. More…

#include <SocketStream.h>

class SocketInputStream:
    public Poco::Net::SocketIOS,
    public istream
{
public:
    // construction

    SocketInputStream(const Socket& socket);
};

Inherited Members

public:
    // methods

    SocketStreamBuf*
    rdbuf();

    void
    close();

    StreamSocket
    socket() const;

protected:
    // fields

    SocketStreamBuf _buf;

Detailed Documentation

An input stream for reading from a socket.

When using formatted input from a SocketInputStream, always ensure that a receive timeout is set for the socket. Otherwise your program might unexpectedly hang.

However, using formatted input from a SocketInputStream is not recommended, due to the read-ahead behavior of istream with formatted reads.

Construction

SocketInputStream(const Socket& socket)

Creates the SocketInputStream with the given socket.

The socket’s SocketImpl must be a StreamSocketImpl, otherwise an InvalidArgumentException is thrown.