# Poco::Net

# class SocketStreamBuf

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

## Description

This is the streambuf class used for reading from and writing to a socket.

## Inheritance

Direct Base Classes: Poco::BufferedBidirectionalStreamBuf

All Base Classes: Poco::BufferedBidirectionalStreamBuf

## Member Summary

Member Functions: readFromDevice, socketImpl, writeToDevice

## Constructors

### SocketStreamBuf

SocketStreamBuf(
const Socket & socket
);

Creates a SocketStreamBuf with the given socket.

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

## Destructor

### ~SocketStreamBuf

~SocketStreamBuf() override;

Destroys the SocketStreamBuf.

## Member Functions

### socketImpl

StreamSocketImpl * socketImpl() const;

Returns the internal SocketImpl.

### readFromDevice

std::streamsize readFromDevice(
char * buffer,
std::streamsize length
) override;

### writeToDevice

std::streamsize writeToDevice(
const char * buffer,
std::streamsize length
) override;