socketrange 1.0.1

Minimal range wrapper of socket


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

socketrange Build Status

Simple range wrapper of socket for D.

Usage

import std.algorithm : equal;
import std.socket : socketPair;
import socketrange;

void main() {
  auto pair = socketPair();
  
  /// Wrap as OutputRange
  auto writer = SocketOutputRange!char(pair[0]);
  
  /// Wrap as InputRange of char
  auto reader = SocketInputRange!char(pair[1]);
  
  write.put("foobar");
  writer.close();
  
  assert(equal(reader, "foobar"));
}

struct SocketOutputRange(E)

Wrap socket as OutputRange of E. E can be void to put any types.

struct SocketInputRange(T)

Wrap socket as InputRange of T.

struct SocketRange(In, Out = In)

Wrap socket as Output/InputRange of In. Out can be void to put any types.

Authors:ukatama

Dependencies: none

Versions:
1.0.1 2016-Apr-18
1.0.0 2015-Dec-14
0.2.0 2015-Dec-03
0.1.1 2015-Dec-02
0.1.0 2015-Dec-02
Show all 6 versions
Stats:

statistics are temporarily disabled.