# 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();

Destroys the SocketStreamBuf.

## Member Functions

### socketImpl

StreamSocketImpl * socketImpl() const;

Returns the internal SocketImpl.

### readFromDevice

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

### writeToDevice

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