Poco::Net

class SocketStream

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

Description

An bidirectional stream for reading from and writing to a socket.

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

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

Inheritance

Direct Base Classes: SocketIOS, std::iostream

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

Member Summary

Inherited Functions: close, rdbuf, socket

Constructors

SocketStream

explicit SocketStream(
    const Socket & socket
);

Creates the SocketStream with the given socket.

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

Destructor

~SocketStream

~SocketStream();

Destroys the SocketStream.

Flushes the buffer, but does not close the socket.