unixSocketChannel function

StreamChannel<List<int>> unixSocketChannel(
  1. String path
)

Implementation

StreamChannel<List<int>> unixSocketChannel(String path) {
  final host = InternetAddress(path, type: InternetAddressType.unix);
  final controller = StreamChannelController<List<int>>(sync: true);
  Socket.connect(host, 0).then((socket) {
    socket.cast<List<int>>().pipe(controller.local.sink);
    controller.local.stream.pipe(socket);
  }, onError: controller.local.sink.addError);
  return controller.foreign;
}