class SocketStream

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


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.


Direct Base Classes: SocketIOS, std::iostream

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

Member Summary

Inherited Functions: close, rdbuf, socket



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.




Destroys the SocketStream.

Flushes the buffer, but does not close the socket.