Skip to content
This repository has been archived by the owner on Jun 24, 2020. It is now read-only.

dart-archive/multi_server_socket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An implementation of dart:io's ServerSocket that wraps multiple servers and forwards methods to all of them. It's useful for listening on multiple network interfaces while still having a unified way of controlling the servers. In particular, it supports serving on both the IPv4 and IPv6 loopback addresses using MultiServerSocket.loopback.

import 'package:multi_server_socket/multi_server_socket.dart';

main() async {
  // Sockets connecting to either http://127.0.0.1:8080 and http://[::1]:8080
  // will be emitted by [server].
  var server = await MultiServerSocket.loopback(8080);

  server.listen((socket) {
    // Communicate with [socket].
  });
}

About

An implementation of dart:io's ServerSocket that wraps multiple servers and forwards methods to all of them

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages