std.socketstream - D Programming Language - Digital Mars

D Programming Language 2.0

# std.socketstream

Warning: This module is considered out-dated and not up to Phobos' current standards. It will remain until we have a suitable replacement, but be aware that it will not remain long term.

SocketStream is a stream for a blocking, connected Socket.

Example:
See /dmd/samples/d/htmlget.d

Authors:
Christopher E. Miller

References:
std.stream

Source:
std/socketstream.d

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.

Copyright © 1999-2013 by Digital Mars, All Rights Reserved | Page generated by Ddoc.