# Poco::Net

# class StreamSocketImpl

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

## Description

This class implements a TCP socket.

## Inheritance

Direct Base Classes: SocketImpl

All Base Classes: SocketImpl, Poco::RefCountedObject

Known Derived Classes: WebSocketImpl, SecureStreamSocketImpl

## Member Summary

Member Functions: sendBytes

Inherited Functions: acceptConnection, address, available, bind, bind6, checkBrokenTimeout, close, connect, connectNB, duplicate, error, fcntl, getBlocking, getBroadcast, getError, getKeepAlive, getLinger, getNoDelay, getOOBInline, getOption, getRawOption, getReceiveBufferSize, getReceiveTimeout, getReuseAddress, getReusePort, getSendBufferSize, getSendTimeout, init, initSocket, initialized, ioctl, lastError, listen, peerAddress, poll, receiveBytes, receiveFrom, referenceCount, release, reset, secure, sendBytes, sendFile, sendFileBlockwise, sendFileNative, sendTo, sendUrgent, setBlocking, setBroadcast, setKeepAlive, setLinger, setNoDelay, setOOBInline, setOption, setRawOption, setReceiveBufferSize, setReceiveTimeout, setReuseAddress, setReusePort, setSendBufferSize, setSendTimeout, shutdown, shutdownReceive, shutdownSend, socketError, sockfd, type, useFileDescriptor

## Constructors

### StreamSocketImpl

StreamSocketImpl();

Creates a StreamSocketImpl.

### StreamSocketImpl

explicit StreamSocketImpl(
SocketAddress::Family addressFamily
);

Creates a SocketImpl, with the underlying socket initialized for the given address family.

### StreamSocketImpl

StreamSocketImpl(
int sockfd
);

Creates a StreamSocketImpl using the given native socket.

## Destructor

### ~StreamSocketImpl

virtual ~StreamSocketImpl();

## Member Functions

### sendBytes

int sendBytes(
const void * buffer,
int length,
int flags = 0
) override;

Ensures that all data in buffer is sent if the socket is blocking. In case of a non-blocking socket, sends as many bytes as possible.

Returns the number of bytes sent. The return value may also be negative to denote some special condition.

See also: Poco::Net::SocketImpl::sendBytes()