# Poco::Net

# class SocketInputStream

Library: Net
Package: Sockets
Header: Poco/Net/SocketStream.h

## Description

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.

## Inheritance

Direct Base Classes: SocketIOS, std::istream

All Base Classes: SocketIOS, std::ios, std::istream

## Member Summary

Inherited Functions: close, rdbuf, socket

## Constructors

### SocketInputStream

explicit SocketInputStream(
const Socket & socket
);

Creates the SocketInputStream with the given socket.

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

## Destructor

### ~SocketInputStream

~SocketInputStream() override;

Destroys the SocketInputStream.