# StreamPair [![NPM version](https://badge.fury.io/js/socket-pair.svg)](http://badge.fury.io/js/socket-pair) A pair of coupled Unix sockets (or Windows pipes). Similar to `stream-pair`, but with sockets with real fds. A workaround for . ## Usage ```javascript var socketPair = require('socket-pair'); socketPair.create(function (err, pair) { var a = pair.client; // as in `client = net.connect()` var b = pair.connection; // as in `server.on('connection', function (conn) { ... })` a.write('123'); b.on('data', function (chunk) { console.log(chunk.toString('utf8')); }); socketPair.closeAll(); }); ``` I named them `client` and `connection`, but their names really have no meaning. You can call them `a` and `b` or `other` and `one` or `red` and `blue`. It makes no difference. ## API ``` socketPair.create(cb) // creates or reuses a socket server socketPair.closeAll() // closes the server and all sockets ```