Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

std.socketstream

Deprecated: This module is considered out-dated and not up to Phobos' current standards. It will be remove in October 2016.
SocketStream is a stream for a blocking, connected Socket.
Authors:
Christopher E. Miller

References: std.stream

class SocketStream: std.stream.Stream;
SocketStream is a stream for a blocking, connected Socket.
this(Socket sock, FileMode mode);
Constructs a SocketStream with the specified Socket and FileMode flags.
this(Socket sock);
Uses mode FileMode.In | FileMode.Out.
Socket socket();
Property to get the Socket that is being streamed.
size_t readBlock(void* _buffer, size_t size);
Attempts to read the entire block, waiting if necessary.
size_t writeBlock(const void* _buffer, size_t size);
Attempts to write the entire block, waiting if necessary.
ulong seek(long offset, SeekPos whence);
Socket streams do not support seeking. This disabled method throws a SeekException.
string toString();
Does not return the entire stream because that would require the remote connection to be closed.
void close();
Close the Socket.