{"_id":"tcpnet","_rev":"37-1b34855218ed690f35644077c2ac2282","name":"tcpnet","description":"Creates TCP connections between nodes without configuration","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"tcpnet","description":"Create a autodiscover horizontal scaleable tcp cluster","version":"0.1.0","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal"],"dependencies":{"mdns":"0.0.x","node-uuid":"1.4.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Create a autodiscover horizontal scaleable tcp cluster\n\n##Mad since\n\nI have hacked to much vertical single OS cluster software, time for a change!\n\n#API\n\n```javascript\nvar tcpnet = require('./tcpnet.js');\nvar uuid = require('node-uuid');\n\nvar create = new Array(32);\n    uuid.v1(null, create, 0);\n    uuid.v4(null, create, 16);\n\nvar service = tcpnet({\n    port: 0, // random\n    host: '0.0.0.0', // everything\n    name: 'custom-name',\n    uuid: create.join('')\n});\n\n// collection of sockets\nservice.on('connection', function (socket) {\n  socket.pipe(process.stdout, {end: false});\n});\n\n// write a message every 100 ms to all other services with same name\nvar randomId = Math.random().toString(10).slice(2);\nsetInterval(function () {\n    console.log('write to ' + service.connections.length + ' worker');\n    service.connections.forEach(function (socket) {\n      socket.write('message from ' + randomId  + '\\n');\n    });\n}, 1000);\n\n// not really nessarry since this is a auto discovery service\nservice.once('listening', function () {\n    var addr = service.address();\n    console.log('opened on: ' + addr.address + ':' + addr.port);\n});\n```\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.1.0","dist":{"shasum":"9569847d544a988a863be86ead452c2d83aa1078","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.1.0.tgz","integrity":"sha512-4+MwRQRZbu1VmFepz0nxz2dJn04ZLF8/eISkJ8wyBC5XnolKRIpHddboOSkqk+A7XhAi/gl5e36vTUYX9JybWA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFTO38E4O74MUlV9uj8nV10cAQXiSaR/gdIVcLyQi6duAiAwZ1/uHiFnXpHGgTLiVMn2KeZJDD7n55R49JYJQ8CVXw=="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"directories":{}},"0.1.1":{"name":"tcpnet","description":"Create a autodiscover horizontal scaleable tcp cluster","version":"0.1.1","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal"],"dependencies":{"mdns":"0.0.x","node-uuid":"1.4.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Create a autodiscover horizontal scaleable tcp cluster\n\n##Mad science\n\nI have hacked to much vertical single OS cluster software, time for a change!\n\n#API\n\n```javascript\nvar tcpnet = require('./tcpnet.js');\nvar uuid = require('node-uuid');\n\nvar create = new Array(32);\n    uuid.v1(null, create, 0);\n    uuid.v4(null, create, 16);\n\nvar service = tcpnet({\n    port: 0, // random\n    host: '0.0.0.0', // everything\n    name: 'custom-name',\n    uuid: create.join('')\n});\n\n// collection of sockets\nservice.on('connection', function (socket) {\n  socket.pipe(process.stdout, {end: false});\n});\n\n// write a message every 100 ms to all other services with same name\nvar randomId = Math.random().toString(10).slice(2);\nsetInterval(function () {\n    console.log('write to ' + service.connections.length + ' worker');\n    service.connections.forEach(function (socket) {\n      socket.write('message from ' + randomId  + '\\n');\n    });\n}, 1000);\n\n// not really nessarry since this is a auto discovery service\nservice.once('listening', function () {\n    var addr = service.address();\n    console.log('opened on: ' + addr.address + ':' + addr.port);\n});\n```\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.1.1","dist":{"shasum":"75c183aade2ff22cd3bfa8c6f118db0efaf12b18","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.1.1.tgz","integrity":"sha512-e+255/TQ6Cw9cVPbMjjHq6L+ZR2j4asTebCSuqU+4OqqCDQp5YeMN8/lbRFqUm7ddfwtfmV2dlcLt0rxEUs1gw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAxzCa9oX1A+h+f5VzQUB6EjhQOQsOPxnVoYcmVdsfQDAiEAhI1ZSskW5WnE85mCKRS8BADbzAmRGnPGs9Z9+jATe8s="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"directories":{}},"0.1.2":{"name":"tcpnet","description":"Create a autodiscover horizontal scaleable tcp cluster","version":"0.1.2","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal"],"dependencies":{"mdns":"0.0.x","async":"0.1.x","node-uuid":"1.4.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Create a autodiscover horizontal scaleable tcp cluster\n\n##Mad science\n\nI have hacked to much vertical single OS cluster software, time for a change!\n\n#API\n\n```javascript\nvar tcpnet = require('./tcpnet.js');\nvar uuid = require('node-uuid');\n\nvar create = new Array(32);\n    uuid.v1(null, create, 0);\n    uuid.v4(null, create, 16);\n\nvar service = tcpnet({\n    port: 0, // random\n    host: '0.0.0.0', // everything\n    name: 'custom-name',\n    uuid: create.join('')\n});\n\n// collection of sockets\nservice.on('connection', function (socket) {\n  socket.pipe(process.stdout, {end: false});\n});\n\n// write a message every 100 ms to all other services with same name\nvar randomId = Math.random().toString(10).slice(2);\nsetInterval(function () {\n    console.log('write to ' + service.connections.length + ' worker');\n    service.connections.forEach(function (socket) {\n      socket.write('message from ' + randomId  + '\\n');\n    });\n}, 1000);\n\n// not really nessarry since this is a auto discovery service\nservice.once('listening', function () {\n    var addr = service.address();\n    console.log('opened on: ' + addr.address + ':' + addr.port);\n});\n```\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.1.2","dist":{"shasum":"9c638c5fc12fd80a88a4991d565b138a801227cc","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.1.2.tgz","integrity":"sha512-bXNjTpQjfgRubL5+6rjKvuADUtZVLDsZEuuSxD92Hw3BG2hsBn9tBeErEDDPOIPxPYjB5Pq3snBhclv3hVEnww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDKniWCJUVVmtO9LGcVeKNpsUeg/vhHCk3CxRJAgnZVmQIgW9yuk0hB/Mgytx6d+T9WGOPrJRkZQnkgFqPdgR++3rA="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"directories":{}},"0.1.3":{"name":"tcpnet","description":"Create zero configuration horizontal tcp cluster","version":"0.1.3","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal"],"dependencies":{"mdns":"0.0.x","async":"0.1.x","node-uuid":"1.4.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Create zero configuration horizontal tcp cluster\n\n##Mad science\n\nI have hacked to much vertical single OS cluster software, time for a change!\n\n#API\n\n```javascript\nvar tcpnet = require('./tcpnet.js');\nvar uuid = require('node-uuid');\n\nvar create = new Array(32);\n    uuid.v1(null, create, 0);\n    uuid.v4(null, create, 16);\n\nvar service = tcpnet({\n    port: 0, // random\n    host: '0.0.0.0', // everything\n    name: 'custom-name',\n    uuid: create.join('')\n});\n\n// collection of sockets\nservice.on('connection', function (socket) {\n  socket.pipe(process.stdout, {end: false});\n});\n\n// write a message every 100 ms to all other services with same name\nvar randomId = Math.random().toString(10).slice(2);\nsetInterval(function () {\n    console.log('write to ' + service.connections.length + ' worker');\n    service.connections.forEach(function (socket) {\n      socket.write('message from ' + randomId  + '\\n');\n    });\n}, 1000);\n\n// not really nessarry since this is a auto discovery service\nservice.once('listening', function () {\n    var addr = service.address();\n    console.log('opened on: ' + addr.address + ':' + addr.port);\n});\n```\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.1.3","dist":{"shasum":"c87b4a83f0e77c8ef63306d49b031e5e8a7e9cbd","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.1.3.tgz","integrity":"sha512-5Sqb9b/vHDdoGdxWZ0M73YqMHByRhpym4EU3JbI9o02yEJnmi2NLEUy6KShFBLZ14VYaR2S0aGoXTBU3utKEoA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDbb5Va93a/HZQWNPwoA/tlHPK9tk8gNKP1HQyF5abCKAiEAwE+Cvx4At5DOD5XFrJT5HnOkw9bRM1PW2mQLQfGMmqw="}]},"_npmVersion":"1.1.66","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"directories":{}},"0.1.4":{"name":"tcpnet","description":"Create zero configuration horizontal tcp cluster","version":"0.1.4","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal"],"dependencies":{"mdns":"0.0.x","async":"0.1.x","node-uuid":"1.4.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Create zero configuration horizontal tcp cluster\n\n##Mad science\n\nI have hacked to much vertical single OS cluster software, time for a change!\n\n#API\n\n```javascript\nvar tcpnet = require('./tcpnet.js');\nvar uuid = require('node-uuid');\n\nvar create = new Array(32);\n    uuid.v1(null, create, 0);\n    uuid.v4(null, create, 16);\n\nvar service = tcpnet({\n    port: 0, // random\n    host: '0.0.0.0', // everything\n    name: 'custom-name',\n    uuid: create.join('')\n});\n\n// collection of sockets\nservice.on('connection', function (socket) {\n  socket.pipe(process.stdout, {end: false});\n});\n\n// write a message every 100 ms to all other services with same name\nvar randomId = Math.random().toString(10).slice(2);\nsetInterval(function () {\n    console.log('write to ' + service.connections.length + ' worker');\n    service.connections.forEach(function (socket) {\n      socket.write('message from ' + randomId  + '\\n');\n    });\n}, 1000);\n\n// not really nessarry since this is a auto discovery service\nservice.once('listening', function () {\n    var addr = service.address();\n    console.log('opened on: ' + addr.address + ':' + addr.port);\n});\n```\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.1.4","dist":{"shasum":"f1fc3822f4bd174fa4bfe707e7bad6baa6b70ab7","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.1.4.tgz","integrity":"sha512-L1QctafUi7gW/iDLhGVayY8yfoPxqDLLwXLyeu4G+XxKyTCyzVJxTIMCxKzPDx7/Oio1CYKQZdtOQ5YVGiuJ1A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCwFwYZ5MkvgrcehFpG8T1dwOuzvXFNwQhylJWFX0OHjgIhAOq4JVhuCWLHW5XbG9+vrYCbIKL/4apUPOWYvk+wbawS"}]},"_npmVersion":"1.1.66","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"directories":{}},"0.1.5":{"name":"tcpnet","description":"Create zero configuration horizontal tcp cluster","version":"0.1.5","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal"],"dependencies":{"mdns":"0.0.x","async":"0.1.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Create zero configuration horizontal tcp cluster\n\n##Mad science\n\nI have hacked to much vertical single OS cluster software, time for a change!\n\n#API\n\n```javascript\nvar tcpnet = require('./tcpnet.js');\n\nvar service = tcpnet('custom-name', function (socket) {\n  socket.pipe(process.stdout, {end: false});\n});\n\nservice.listen();\n\n// write a message every one sec to all other services with same name\nvar randomId = Math.random().toString(10).slice(2);\nsetInterval(function () {\n  console.log('write to ' + service.connections.length + ' worker');\n  service.connections.forEach(function (socket) {\n    socket.write('message from ' + randomId  + '\\n');\n  });\n}, 1000);\n\n// not really nessarry since this is a auto discovery service\nservice.once('listening', function () {\n  var addr = service.address();\n  console.log('uuid:', service._uuidString);\n  console.log('opened on: ', addr.addresses, 'port:', addr.port);\n});\n```\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.1.5","dist":{"shasum":"d2655c8be94f6095446f2e7b47b3e408a34ec204","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.1.5.tgz","integrity":"sha512-wqwJtsIF2lnax6pP+EBss4SOPZTJ9a5F4YYTMjhI0vjXfEeJKCkfSf+o1yHGZftgeZL1+3D1IzDKiQil9OkP3Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGDG8eAkzA0gDqOjJJO8KvZGy9K42y8Dtata52vZikNbAiEA/D/BgpL3y/k5cDtWlj188xoPC4pY17Y9TC7OOAXBOZQ="}]},"_npmVersion":"1.1.66","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"directories":{}},"0.1.6":{"name":"tcpnet","description":"Create zero configuration horizontal tcp cluster","version":"0.1.6","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal"],"dependencies":{"mdns":"0.0.x","async":"0.1.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Create zero configuration horizontal tcp cluster\n\n##Mad science\n\nI have hacked to much vertical single OS cluster software, time for a change!\n\n#API\n\n```javascript\nvar tcpnet = require('./tcpnet.js');\n\nvar service = tcpnet('custom-name', function (socket) {\n  socket.pipe(process.stdout, {end: false});\n});\n\nservice.listen();\n\n// write a message every one sec to all other services with same name\nvar randomId = Math.random().toString(10).slice(2);\nsetInterval(function () {\n  console.log('write to ' + service.connections.length + ' worker');\n  service.connections.forEach(function (socket) {\n    socket.write('message from ' + randomId  + '\\n');\n  });\n}, 1000);\n\n// not really nessarry since this is a auto discovery service\nservice.once('listening', function () {\n  var addr = service.address();\n  console.log('uuid:', service._uuidString);\n  console.log('opened on: ', addr.addresses, 'port:', addr.port);\n});\n```\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.1.6","dist":{"shasum":"f6c7dd5becc6d597130588463de769583d43c5b4","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.1.6.tgz","integrity":"sha512-P5K2a1GlfxbyQK1W33/q4ce/XP17HsdYShqMLF758YIUcLztydldXCJzacVXpuJlmFsg1tdacFCEK028D/ZJvA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDDnBGl4s5LmAqhmtiDoynOZd/aLreh/elnthFMH+UWqgIgbyPEz6hemx/AceXyx+wjf2XnRygkTE2Eyl62B6LeZlY="}]},"_npmVersion":"1.1.66","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"directories":{}},"0.1.7":{"name":"tcpnet","description":"Create zero configuration horizontal tcp cluster","version":"0.1.7","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal","nodes","network","connections","fully connected","share","state","parallel"],"dependencies":{"mdns":"0.0.x","async":"0.1.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Create zero configuration horizontal tcp cluster\n\n##Mad science\n\nI have hacked to much vertical single OS cluster software, time for a change!\n\n#API\n\n```javascript\nvar tcpnet = require('./tcpnet.js');\n\nvar service = tcpnet('custom-name', function (socket) {\n  socket.pipe(process.stdout, {end: false});\n});\n\nservice.listen();\n\n// write a message every one sec to all other services with same name\nvar randomId = Math.random().toString(10).slice(2);\nsetInterval(function () {\n  console.log('write to ' + service.connections.length + ' worker');\n  service.connections.forEach(function (socket) {\n    socket.write('message from ' + randomId  + '\\n');\n  });\n}, 1000);\n```\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.1.7","dist":{"shasum":"7686285899ce078f255929eb4653ba20fe1cc20e","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.1.7.tgz","integrity":"sha512-xVZxVuk35LxB3oYUckQLNQZZEgKK84ILN781Kz6k4OVwAjzQ67LSqRA3IB5sGryEoyobDLSreEkSJXos4G5k1Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDxB7z03gyAWIj+k2w0y4NxkQ+ThvOfiQ56oUpixQSckgIgePYavtdnhyFSIo2va1QAtGkksxI/9mAWB5DcPgGU2zw="}]},"_npmVersion":"1.1.66","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}]},"0.1.9":{"name":"tcpnet","description":"Create zero configuration horizontal tcp cluster","version":"0.1.9","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal","nodes","network","connections","fully connected","share","state","parallel"],"dependencies":{"mdns":"1.0.x","async":"0.1.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Create zero configuration horizontal tcp cluster\n\n##Mad science\n\nI have hacked to much vertical single OS cluster software, time for a change!\n\n#API\n\n```javascript\nvar tcpnet = require('./tcpnet.js');\n\nvar service = tcpnet('custom-name', function (socket) {\n  socket.pipe(process.stdout, {end: false});\n});\n\nservice.listen();\n\n// write a message every one sec to all other services with same name\nvar randomId = Math.random().toString(10).slice(2);\nsetInterval(function () {\n  console.log('write to ' + service.connections.length + ' worker');\n  service.connections.forEach(function (socket) {\n    socket.write('message from ' + randomId  + '\\n');\n  });\n}, 1000);\n```\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.1.9","dist":{"shasum":"f0dc429a089ade5facf51b876b8f7e89f83ea8d2","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.1.9.tgz","integrity":"sha512-WpNdXYKGFvym5aWLYDj+ul3NXMZiBwHJeE/KJZcgfpisJNX8GUdDiOPpMaqB2E15IHywd10SBIcKPLBvpW+/vw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCusM9akqaRjAzECBZGwJ7M/hiwW+SdbZFFjNcQCOyH1AIhANvTGtoiDRx+Z8qq98L+2p28lHhGPDhdDIHeH0g8NNHp"}]},"_npmVersion":"1.1.66","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}]},"0.1.10":{"name":"tcpnet","description":"Create zero configuration horizontal tcp cluster","version":"0.1.10","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal","nodes","network","connections","fully connected","share","state","parallel"],"dependencies":{"mdns":"1.0.x","isme":"0.3.x","gmid":"0.3.x","async":"0.1.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Create zero configuration horizontal tcp cluster\n\n##Mad science\n\nI have hacked to much vertical single OS cluster software, time for a change!\n\n#API\n\n```javascript\nvar tcpnet = require('./tcpnet.js');\n\nvar service = tcpnet('custom-name', function (socket) {\n  socket.pipe(process.stdout, {end: false});\n});\n\nservice.listen();\n\n// write a message every one sec to all other services with same name\nvar randomId = Math.random().toString(10).slice(2);\nsetInterval(function () {\n  console.log('write to ' + service.connections.length + ' worker');\n  service.connections.forEach(function (socket) {\n    socket.write('message from ' + randomId  + '\\n');\n  });\n}, 1000);\n```\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.1.10","dist":{"shasum":"e8cc03a88eaae223482f4556c7cad00d87c786d1","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.1.10.tgz","integrity":"sha512-26WN4HUNYiDRUQ+h3DDVvRV4F//v/+c0+5KzqJfaZFB7lZgZ6+kJgj3DRrAIALDg3tOVMS9PS5+qObpSK+mhHw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD2R+wV4lQq4QdJZNQRHQtLjkrVV0xwmEVG3G4rt6jIygIgFlkvxam3xJUjxKOz9nV4CKgtnSBaayUOfqOku3TQpcY="}]},"_npmVersion":"1.1.69","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}]},"0.1.11":{"name":"tcpnet","description":"Create zero configuration horizontal tcp cluster","version":"0.1.11","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal","nodes","network","connections","fully connected","share","state","parallel"],"dependencies":{"mdns":"1.0.x","isme":"0.3.x","gmid":"0.3.x","async":"0.1.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Creates TCP connections between nodes without configuration.\n\n## Installation\n\n```sheel\nnpm install tcpnet\n```\n\n## Example\n\n```javascript\nvar tcpnet = require('tcpnet');\n\n// Create a service called my-cluster, for every TCP connection\n// pipe the output to the terminal\nvar service = tcpnet('my-cluster', function (socket) {\n  socket.pipe(process.stdout);\n});\n\n// For every one second send a message to all other services on the network\nvar randomId = require('crypto').randomBytes(6).toString('hex');\nsetInterval(function () {\n  console.log('write to ' + service.connections.length + ' nodes');\n  service.connections.forEach(function (socket) {\n    socket.write('message from ' + randomId  + '\\n');\n  });\n}, 1000);\n\n// Pick a random port, and use all available addresses\nservice.listen(0, '0.0.0.0');\n```\n\nNot startup a few node.js processes with this code, and you will see this:\n\n```shell\n$node demo.js\n\nwrite to 2 nodes\nmessage from a6c953a8c1f1\nmessage from 4eba8c4e76e9\nwrite to 2 nodes\nmessage from a6c953a8c1f1\nmessage from 4eba8c4e76e9\n```\n\n## API documentation\n\n> In more detail this is a module for creating a [fully connected](http://en.wikipedia.org/wiki/File:NetworkTopology-FullyConnected.png)\nnode cluster, that means that each node is aware of all other running nodes by\na TCP connection. For the time being this is limited to a local network, that\nmeans you can't connect nodes across the internet, however connection nodes\non a local network (switch or router) works perfectly. But thoughts are being\nmade.\n\n### service = tcpnet(settings, [connection])\n\nThis function creates a new service instance.\n\nThe `settings` argument is required and can be a `string` or an `object`.\nStarting with the `string` case. This is the name of the service and is\nthe only thing there must be shared between all services (nodes).\n\nExample: this code creates two services, they share the same name so they\nwill automaticly be connected.\n\n```javascript\nvar serviceA = tcpnet('my-cluster');\n    serviceA.listen();\n\nvar serviceB = tcpnet('my-cluster');\n    serviceB.listen();\n```\n\nThe `settings` argument can also be an `object`, this provides some more\noptions, there are given by the following paramenters:\n\n* `name` required - exactly the same as the `string` case.\n* `uuid` optional - each service instance **must** have a unique ID,\n if two service instances share the same connection they can't connect\n and may not be able to reach all other servies, with diffrent IDs.\n By default the uuid is created by the [gmid](https://github.com/AndreasMadsen/gmid)\n module. Note there are two requirements for the uuid. One, it must be a\n hexidecimal string (e.g. `BADA55`). Two, they all ids must have a fixed\n length (e.g. `AA` and `CCCCCC` won't work).\n\nThe next argument `connection` is a optional function there if given, will\nbe added as a `connection` event handler.\n\nExample: this code will do the same as the one below:\n\n```javascript\nvar service = tcpnet('my-cluster', function (socket) {\n  // do something with the TCP socket\n});\n\nservice.listen();\n```\n\n```javascript\nvar service = tcpnet('my-cluster');\n\nservice.on('connection', function (socket) {\n  // do something with the TCP socket\n});\n\nservice.listen();\n```\n\n### service.listen([port], [address], [callback])\n\nThe first argument `port` is no big surprise, its the port that the\nservice will use to receive other connections. By default `port` is `0`\nwhich is just a random available `port` assigned by the OS.\n\nThe second argument `address` is the address you want to listen on, by\ndefault `address` is `0.0.0.0` which is all available addresses (localhost\nand public). Do also note that `address` can be a domain (e.q. `localhost`), it\nwill just be resoved to a IP address by a DNS lookup.\n\nExample: 3 ways to listen on only the loopback interface.\n\n```javascript\nservice.listen(0, '127.0.0.1');\nservice.listen(0, '::1');\nservice.listen(0, 'localhost');\n```\n\n_NOTE: because there apear to be a bug in `MDNS` a public only address\n(e.q. `192.168.0.198`) is not allowed, if you wan't the service to be public\nyou will have to use `0.0.0.0` for the time being._\n\nThe third argument `callback` is just an `listening` event handler.\n\n```javascript\nservice.listen(function () {\n  console.log('service is ready');\n});\n```\n\n### service.address();\n\nThis method will return an object containing two properties:\n\n* `port`\n* `addresses`\n\nNOTE: do not use this before the `listening` has emitted, if you do so it will\nreturn `null`.\n\nExample: show the port and addresses that the service is listening on:\n\n```javascript\nservice.listen(0, '0.0.0.0', function () {\n  console.log('service is ready and listening on:');\n\n  var info = service.address();\n  info.addresses.forEach(function (address) {\n    console.log('- ' + address + ':' + info.port);\n  });\n});\n\n/*  Output could be:\n * - 127.0.0.1:52740\n * - 192.168.0.198:52740\n * - ::1:52740\n * - fe80::5ab0:35ff:fe84:84b1:52740\n*/\n```\n\n### service.connections\n\nThis is a dynamic array containing all online sockets. This means that sockets\nwill be added once the `connection` event fires and removed once socket `close`\nevent fires.\n\nExample: multicast a single message from this service to all other online\nservices.\n\n```javascript\nservice.connections.forEach(function (socket) {\n  socket.write('hallo message to you from me\\n');\n});\n```\n\n### service.close([callback])\n\nThis method will close the service and call `socket.end()` on all online\nconnections.\n\nThe optional `callback` arguments will be assigned as an `close` event handler.\n\n```javascript\nservice.close(function () {\n  // everything related to the service is now closed, unless there are other\n  // this running node will automaticly shutdown this process.\n});\n```\n\n### Event: connection\n\nThis event is emitted once a new socket becomes online, to detect the when\nis offline use the socket `close` event:\n\nExample: how to detect remote service shutdown\n\n```javascript\nservice.on('connection', function (socket) {\n  socket.once('close', function () {\n    console.log('the service is most likely dead now');\n  });\n});\n```\n\n### Event: error\n\nIf an `error` occurres in the `server` or between establing a `TCP` connection\nand the actuall `connection` event the `error` event will emit. Be aware that\nif no `error` handler exist the error will be throwen.\n\nExample: on one way to handle errors (but almost like just throwing)\n\n```javascript\nservice.on('error', function (err) {\n  console.error(err.stack);\n\n  // oh no, an error we better just close the service\n  service.close(function () {\n\n    // if anything else is running, then it won't be shutdown gracefully\n    process.exit(1);\n  });\n});\n```\n\n### Event: listening\n\nOnce the service is online this event will emit, note that calling\n`service.address()` is quite useless if this event hasn't been emitted.\n\n### Event: close\n\nThe service is now closed dude to a `service.close` call.\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.1.11","dist":{"shasum":"394528e1d952a38b767364924b99e58c511d927d","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.1.11.tgz","integrity":"sha512-9ZIDDqmPBcmvY6WHzIxVDbOJglHNqUQEM+7DBmw+apbz0EANeFAYB5+BJ6I/GQ49HslV8AAAQ1mjRBlU1wZ0ww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDzCnV8zT6oR9e4212euhuzqdFHG+AgZYa+gq7FIAE2WwIgFjtAKnSCwE8Zd2hUbS1OTrPZqk4WJRurl8+huGXxZOg="}]},"_npmVersion":"1.1.69","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}]},"0.1.12":{"name":"tcpnet","description":"Create zero configuration horizontal tcp cluster","version":"0.1.12","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal","nodes","network","connections","fully connected","share","state","parallel"],"dependencies":{"mdns":"1.0.x","isme":"0.3.x","gmid":"0.3.x","async":"0.1.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Creates TCP connections between nodes without configuration.\n\n## Installation\n\n```sheel\nnpm install tcpnet\n```\n\n## Example\n\n```javascript\nvar tcpnet = require('tcpnet');\n\n// Create a service called my-cluster, for every TCP connection\n// pipe the output to the terminal\nvar service = tcpnet('my-cluster', function (socket) {\n  socket.pipe(process.stdout);\n});\n\n// For every one second send a message to all other services on the network\nvar randomId = require('crypto').randomBytes(6).toString('hex');\nsetInterval(function () {\n  console.log('write to ' + service.connections.length + ' nodes');\n  service.connections.forEach(function (socket) {\n    socket.write('message from ' + randomId  + '\\n');\n  });\n}, 1000);\n\n// Pick a random port, and use all available addresses\nservice.listen(0, '0.0.0.0');\n```\n\nNot startup a few node.js processes with this code, and you will see this:\n\n```shell\n$node demo.js\n\nwrite to 2 nodes\nmessage from a6c953a8c1f1\nmessage from 4eba8c4e76e9\nwrite to 2 nodes\nmessage from a6c953a8c1f1\nmessage from 4eba8c4e76e9\n```\n\n## API documentation\n\n> In more detail this is a module for creating a [fully connected](http://en.wikipedia.org/wiki/File:NetworkTopology-FullyConnected.png)\nnode cluster, that means that each node is aware of all other running nodes by\na TCP connection. For the time being this is limited to a local network, that\nmeans you can't connect nodes across the internet, however connection nodes\non a local network (switch or router) works perfectly. But thoughts are being\nmade.\n\n### service = tcpnet(settings, [connection])\n\nThis function creates a new service instance.\n\nThe `settings` argument is required and can be a `string` or an `object`.\nStarting with the `string` case. This is the name of the service and is\nthe only thing there must be shared between all services (nodes).\n\nExample: this code creates two services, they share the same name so they\nwill automaticly be connected.\n\n```javascript\nvar serviceA = tcpnet('my-cluster');\n    serviceA.listen();\n\nvar serviceB = tcpnet('my-cluster');\n    serviceB.listen();\n```\n\nThe `settings` argument can also be an `object`, this provides some more\noptions, there are given by the following paramenters:\n\n* `name` required - exactly the same as the `string` case.\n* `uuid` optional - each service instance **must** have a unique ID,\n if two service instances share the same connection they can't connect\n and may not be able to reach all other servies, with diffrent IDs.\n By default the uuid is created by the [gmid](https://github.com/AndreasMadsen/gmid)\n module. Note there are two requirements for the uuid. One, it must be a\n hexidecimal string (e.g. `BADA55`). Two, they all ids must have a fixed\n length (e.g. `AA` and `CCCCCC` won't work).\n\nThe next argument `connection` is a optional function there if given, will\nbe added as a `connection` event handler.\n\nExample: this code will do the same as the one below:\n\n```javascript\nvar service = tcpnet('my-cluster', function (socket) {\n  // do something with the TCP socket\n});\n\nservice.listen();\n```\n\n```javascript\nvar service = tcpnet('my-cluster');\n\nservice.on('connection', function (socket) {\n  // do something with the TCP socket\n});\n\nservice.listen();\n```\n\n### service.listen([port], [address], [callback])\n\nThe first argument `port` is no big surprise, its the port that the\nservice will use to receive other connections. By default `port` is `0`\nwhich is just a random available `port` assigned by the OS.\n\nThe second argument `address` is the address you want to listen on, by\ndefault `address` is `0.0.0.0` which is all available addresses (localhost\nand public). Do also note that `address` can be a domain (e.q. `localhost`), it\nwill just be resoved to a IP address by a DNS lookup.\n\nExample: 3 ways to listen on only the loopback interface.\n\n```javascript\nservice.listen(0, '127.0.0.1');\nservice.listen(0, '::1');\nservice.listen(0, 'localhost');\n```\n\n_NOTE: because there apear to be a bug in `MDNS` a public only address\n(e.q. `192.168.0.198`) is not allowed, if you wan't the service to be public\nyou will have to use `0.0.0.0` for the time being._\n\nThe third argument `callback` is just an `listening` event handler.\n\n```javascript\nservice.listen(function () {\n  console.log('service is ready');\n});\n```\n\n### service.address();\n\nThis method will return an object containing two properties:\n\n* `port`\n* `addresses`\n\nNOTE: do not use this before the `listening` has emitted, if you do so it will\nreturn `null`.\n\nExample: show the port and addresses that the service is listening on:\n\n```javascript\nservice.listen(0, '0.0.0.0', function () {\n  console.log('service is ready and listening on:');\n\n  var info = service.address();\n  info.addresses.forEach(function (address) {\n    console.log('- ' + address + ':' + info.port);\n  });\n});\n\n/*  Output could be:\n * - 127.0.0.1:52740\n * - 192.168.0.198:52740\n * - ::1:52740\n * - fe80::5ab0:35ff:fe84:84b1:52740\n*/\n```\n\n### service.connections\n\nThis is a dynamic array containing all online sockets. This means that sockets\nwill be added once the `connection` event fires and removed once socket `close`\nevent fires.\n\nExample: multicast a single message from this service to all other online\nservices.\n\n```javascript\nservice.connections.forEach(function (socket) {\n  socket.write('hallo message to you from me\\n');\n});\n```\n\n### service.close([callback])\n\nThis method will close the service and call `socket.end()` on all online\nconnections.\n\nThe optional `callback` arguments will be assigned as an `close` event handler.\n\n```javascript\nservice.close(function () {\n  // everything related to the service is now closed, unless there are other\n  // this running node will automaticly shutdown this process.\n});\n```\n\n### Event: connection\n\nThis event is emitted once a new socket becomes online, to detect the when\nis offline use the socket `close` event:\n\nExample: how to detect remote service shutdown\n\n```javascript\nservice.on('connection', function (socket) {\n  socket.once('close', function () {\n    console.log('the service is most likely dead now');\n  });\n});\n```\n\n### Event: error\n\nIf an `error` occurres in the `server` or between establing a `TCP` connection\nand the actuall `connection` event the `error` event will emit. Be aware that\nif no `error` handler exist the error will be throwen.\n\nExample: on one way to handle errors (but almost like just throwing)\n\n```javascript\nservice.on('error', function (err) {\n  console.error(err.stack);\n\n  // oh no, an error we better just close the service\n  service.close(function () {\n\n    // if anything else is running, then it won't be shutdown gracefully\n    process.exit(1);\n  });\n});\n```\n\n### Event: listening\n\nOnce the service is online this event will emit, note that calling\n`service.address()` is quite useless if this event hasn't been emitted.\n\n### Event: close\n\nThe service is now closed dude to a `service.close` call.\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.1.12","dist":{"shasum":"48bb4a49d2265171d91b7ab8ec1d7f361c2222ff","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.1.12.tgz","integrity":"sha512-rUIqP8aGueb69IDSA59dImg/QrvlEhDyRev3NguY1vP0y3W8YTPCNTpT007dIvMu+UpOaY5XAgi/+/e6fgltUw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGDwiFwtjNDjW+EiChvXYY4fNgCMP6mJedgV1I5NhhOPAiAVA07Tp2ZnBJ3AqEoawVkOOafqE0fy4yHHDZQxY3yBng=="}]},"_npmVersion":"1.1.69","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}]},"0.1.13":{"name":"tcpnet","description":"Creates TCP connections between nodes without configuration","version":"0.1.13","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal","nodes","network","connections","fully connected","share","state","parallel"],"dependencies":{"mdns":"1.0.x","isme":"0.3.x","gmid":"0.3.x","async":"0.1.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Creates TCP connections between nodes without configuration.\n\n## Installation\n\n```sheel\nnpm install tcpnet\n```\n\nIf the module dosn't work checkout the `node-mdns` [install instructions](https://github.com/agnat/node_mdns#installation).\n\n## Example\n\n```javascript\nvar tcpnet = require('tcpnet');\n\n// Create a service called my-cluster, for every TCP connection\n// pipe the output to the terminal\nvar service = tcpnet('my-cluster', function (socket) {\n  socket.pipe(process.stdout);\n});\n\n// For every one second send a message to all other services on the network\nvar randomId = require('crypto').randomBytes(6).toString('hex');\nsetInterval(function () {\n  console.log('write to ' + service.connections.length + ' nodes');\n  service.connections.forEach(function (socket) {\n    socket.write('message from ' + randomId  + '\\n');\n  });\n}, 1000);\n\n// Pick a random port, and use all available addresses\nservice.listen(0, '0.0.0.0');\n```\n\nNot startup a few node.js processes with this code, and you will see this:\n\n```shell\n$node demo.js\n\nwrite to 2 nodes\nmessage from a6c953a8c1f1\nmessage from 4eba8c4e76e9\nwrite to 2 nodes\nmessage from a6c953a8c1f1\nmessage from 4eba8c4e76e9\n```\n\n## API documentation\n\n> In more detail this is a module for creating a [fully connected](http://en.wikipedia.org/wiki/File:NetworkTopology-FullyConnected.png)\nnode cluster, that means that each node is aware of all other running nodes by\na TCP connection. For the time being this is limited to a local network, that\nmeans you can't connect nodes across the internet, however connection nodes\non a local network (switch or router) works perfectly. But thoughts are being\nmade.\n\n### service = tcpnet(settings, [connection])\n\nThis function creates a new service instance.\n\nThe `settings` argument is required and can be a `string` or an `object`.\nStarting with the `string` case. This is the name of the service and is\nthe only thing there must be shared between all services (nodes).\n\nExample: this code creates two services, they share the same name so they\nwill automaticly be connected.\n\n```javascript\nvar serviceA = tcpnet('my-cluster');\n    serviceA.listen();\n\nvar serviceB = tcpnet('my-cluster');\n    serviceB.listen();\n```\n\nThe `settings` argument can also be an `object`, this provides some more\noptions, there are given by the following paramenters:\n\n* `name` required - exactly the same as the `string` case.\n* `uuid` optional - each service instance **must** have a unique ID,\n if two service instances share the same connection they can't connect\n and may not be able to reach all other servies, with diffrent IDs.\n By default the uuid is created by the [gmid](https://github.com/AndreasMadsen/gmid)\n module. Note there are two requirements for the uuid. One, it must be a\n hexidecimal string (e.g. `BADA55`). Two, they all ids must have a fixed\n length (e.g. `AA` and `CCCCCC` won't work).\n\nThe next argument `connection` is a optional function there if given, will\nbe added as a `connection` event handler.\n\nExample: this code will do the same as the one below:\n\n```javascript\nvar service = tcpnet('my-cluster', function (socket) {\n  // do something with the TCP socket\n});\n\nservice.listen();\n```\n\n```javascript\nvar service = tcpnet('my-cluster');\n\nservice.on('connection', function (socket) {\n  // do something with the TCP socket\n});\n\nservice.listen();\n```\n\n### service.listen([port], [address], [callback])\n\nThe first argument `port` is no big surprise, its the port that the\nservice will use to receive other connections. By default `port` is `0`\nwhich is just a random available `port` assigned by the OS.\n\nThe second argument `address` is the address you want to listen on, by\ndefault `address` is `0.0.0.0` which is all available addresses (localhost\nand public). Do also note that `address` can be a domain (e.q. `localhost`), it\nwill just be resoved to a IP address by a DNS lookup.\n\nExample: 3 ways to listen on only the loopback interface.\n\n```javascript\nservice.listen(0, '127.0.0.1');\nservice.listen(0, '::1');\nservice.listen(0, 'localhost');\n```\n\n_NOTE: because there apear to be a bug in `MDNS` a public only address\n(e.q. `192.168.0.198`) is not allowed, if you wan't the service to be public\nyou will have to use `0.0.0.0` for the time being._\n\nThe third argument `callback` is just an `listening` event handler.\n\n```javascript\nservice.listen(function () {\n  console.log('service is ready');\n});\n```\n\n### service.address()\n\nThis method will return an object containing two properties:\n\n* `port`\n* `addresses`\n\nNOTE: do not use this before the `listening` has emitted, if you do so it will\nreturn `null`.\n\nExample: show the port and addresses that the service is listening on:\n\n```javascript\nservice.listen(0, '0.0.0.0', function () {\n  console.log('service is ready and listening on:');\n\n  var info = service.address();\n  info.addresses.forEach(function (address) {\n    console.log('- ' + address + ':' + info.port);\n  });\n});\n\n/*  Output could be:\n * - 127.0.0.1:52740\n * - 192.168.0.198:52740\n * - ::1:52740\n * - fe80::5ab0:35ff:fe84:84b1:52740\n*/\n```\n\n### service.connections\n\nThis is a dynamic array containing all online sockets. This means that sockets\nwill be added once the `connection` event fires and removed once socket `close`\nevent fires.\n\nExample: multicast a single message from this service to all other online\nservices.\n\n```javascript\nservice.connections.forEach(function (socket) {\n  socket.write('hallo message to you from me\\n');\n});\n```\n\n### service.close([callback])\n\nThis method will close the service and call `socket.end()` on all online\nconnections.\n\nThe optional `callback` arguments will be assigned as an `close` event handler.\n\n```javascript\nservice.close(function () {\n  // everything related to the service is now closed, unless there are other\n  // this running node will automaticly shutdown this process.\n});\n```\n\n### Event: connection\n\nThis event is emitted once a new socket becomes online, to detect the when\nis offline use the socket `close` event:\n\nExample: how to detect remote service shutdown\n\n```javascript\nservice.on('connection', function (socket) {\n  socket.once('close', function () {\n    console.log('the service is most likely dead now');\n  });\n});\n```\n\n### Event: error\n\nIf an `error` occurres in the `server` or between establing a `TCP` connection\nand the actuall `connection` event the `error` event will emit. Be aware that\nif no `error` handler exist the error will be throwen.\n\nExample: on one way to handle errors (but almost like just throwing)\n\n```javascript\nservice.on('error', function (err) {\n  console.error(err.stack);\n\n  // oh no, an error we better just close the service\n  service.close(function () {\n\n    // if anything else is running, then it won't be shutdown gracefully\n    process.exit(1);\n  });\n});\n```\n\n### Event: listening\n\nOnce the service is online this event will emit, note that calling\n`service.address()` is quite useless if this event hasn't been emitted.\n\n### Event: close\n\nThe service is now closed dude to a `service.close` call.\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.1.13","dist":{"shasum":"a6c3aa3d56d22cdacc1185459148ac39413552d6","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.1.13.tgz","integrity":"sha512-oDUWKWlzApxxheM8jdclDxcma5UjifXW/FBCl2ZhUDoKmGapsGpS914qA47GArcfZ+LO9AM0KRDoa3nC26iE2g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBcGq6sTx8dJi80Qmhru/0d7+lT0xwkKFlnacY+7budjAiEAvxELpVSZ2WgXxZVZQSu7X7ZJm2BofMjpGA5Clcics8I="}]},"_npmVersion":"1.1.69","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}]},"0.2.0":{"name":"tcpnet","description":"Creates TCP connections between nodes without configuration","version":"0.2.0","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal","nodes","network","connections","fully connected","share","state","parallel"],"dependencies":{"mdns":"1.1.x","isme":"0.3.x","gmid":"0.3.x","async":"0.1.x","interface-name":"0.2.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Creates TCP connections between nodes without configuration.\n\n## Installation\n\n```sheel\nnpm install tcpnet\n```\n\nIf the module dosn't work checkout the `node-mdns` [install instructions](https://github.com/agnat/node_mdns#installation).\n\n## Example\n\n```javascript\nvar tcpnet = require('tcpnet');\n\n// Create a service called my-cluster, for every TCP connection\n// pipe the output to the terminal\nvar service = tcpnet('my-cluster', function (socket) {\n  socket.pipe(process.stdout);\n});\n\n// For every one second send a message to all other services on the network\nvar randomId = require('crypto').randomBytes(6).toString('hex');\nsetInterval(function () {\n  console.log('write to ' + service.connections.length + ' nodes');\n  service.connections.forEach(function (socket) {\n    socket.write('message from ' + randomId  + '\\n');\n  });\n}, 1000);\n\n// Pick a random port, and use all available addresses\nservice.listen(0, '0.0.0.0');\n```\n\nNot startup a few node.js processes with this code, and you will see this:\n\n```shell\n$node demo.js\n\nwrite to 2 nodes\nmessage from a6c953a8c1f1\nmessage from 4eba8c4e76e9\nwrite to 2 nodes\nmessage from a6c953a8c1f1\nmessage from 4eba8c4e76e9\n```\n\n## API documentation\n\n> In more detail this is a module for creating a [fully connected](http://en.wikipedia.org/wiki/File:NetworkTopology-FullyConnected.png)\nnode cluster, that means that each node is aware of all other running nodes by\na TCP connection. For the time being this is limited to a local network, that\nmeans you can't connect nodes across the internet, however connection nodes\non a local network (switch or router) works perfectly. But thoughts are being\nmade.\n\n### service = tcpnet(settings, [connection])\n\nThis function creates a new service instance.\n\nThe `settings` argument is required and can be a `string` or an `object`.\nStarting with the `string` case. This is the name of the service and is\nthe only thing there must be shared between all services (nodes).\n\nExample: this code creates two services, they share the same name so they\nwill automaticly be connected.\n\n```javascript\nvar serviceA = tcpnet('my-cluster');\n    serviceA.listen();\n\nvar serviceB = tcpnet('my-cluster');\n    serviceB.listen();\n```\n\nThe `settings` argument can also be an `object`, this provides some more\noptions, there are given by the following paramenters:\n\n* `name` required - exactly the same as the `string` case.\n* `uuid` optional - each service instance **must** have a unique ID,\n if two service instances share the same connection they can't connect\n and may not be able to reach all other servies, with diffrent IDs.\n By default the uuid is created by the [gmid](https://github.com/AndreasMadsen/gmid)\n module. Note there are two requirements for the uuid. One, it must be a\n hexidecimal string (e.g. `BADA55`). Two, they all ids must have a fixed\n length (e.g. `AA` and `CCCCCC` won't work).\n\nThe next argument `connection` is a optional function there if given, will\nbe added as a `connection` event handler.\n\nExample: this code will do the same as the one below:\n\n```javascript\nvar service = tcpnet('my-cluster', function (socket) {\n  // do something with the TCP socket\n});\n\nservice.listen();\n```\n\n```javascript\nvar service = tcpnet('my-cluster');\n\nservice.on('connection', function (socket) {\n  // do something with the TCP socket\n});\n\nservice.listen();\n```\n\n### service.listen([port], [address], [callback])\n\nThe first argument `port` is no big surprise, its the port that the\nservice will use to receive other connections. By default `port` is `0`\nwhich is just a random available `port` assigned by the OS.\n\nThe second argument `address` is the address you want to listen on, by\ndefault `address` is `0.0.0.0` which is all available addresses (localhost\nand public). Do also note that `address` can be a domain (e.q. `localhost`), it\nwill just be resoved to a IP address by a DNS lookup.\n\nExample: 3 ways to listen on only the loopback interface.\n\n```javascript\nservice.listen(0, '127.0.0.1');\nservice.listen(0, '::1');\nservice.listen(0, 'localhost');\n```\n\n_NOTE: because there apear to be a bug in `MDNS` a public only address\n(e.q. `192.168.0.198`) is not allowed, if you wan't the service to be public\nyou will have to use `0.0.0.0` for the time being._\n\nThe third argument `callback` is just an `listening` event handler.\n\n```javascript\nservice.listen(function () {\n  console.log('service is ready');\n});\n```\n\n### service.address()\n\nThis method will return an object containing two properties:\n\n* `port`\n* `addresses`\n\nNOTE: do not use this before the `listening` has emitted, if you do so it will\nreturn `null`.\n\nExample: show the port and addresses that the service is listening on:\n\n```javascript\nservice.listen(0, '0.0.0.0', function () {\n  console.log('service is ready and listening on:');\n\n  var info = service.address();\n  info.addresses.forEach(function (address) {\n    console.log('- ' + address + ':' + info.port);\n  });\n});\n\n/*  Output could be:\n * - 127.0.0.1:52740\n * - 192.168.0.198:52740\n * - ::1:52740\n * - fe80::5ab0:35ff:fe84:84b1:52740\n*/\n```\n\n### service.connections\n\nThis is a dynamic array containing all online sockets. This means that sockets\nwill be added once the `connection` event fires and removed once socket `close`\nevent fires.\n\nExample: multicast a single message from this service to all other online\nservices.\n\n```javascript\nservice.connections.forEach(function (socket) {\n  socket.write('hallo message to you from me\\n');\n});\n```\n\n### service.close([callback])\n\nThis method will close the service and call `socket.end()` on all online\nconnections.\n\nThe optional `callback` arguments will be assigned as an `close` event handler.\n\n```javascript\nservice.close(function () {\n  // everything related to the service is now closed, unless there are other\n  // this running node will automaticly shutdown this process.\n});\n```\n\n### Event: connection\n\nThis event is emitted once a new socket becomes online, to detect the when\nis offline use the socket `close` event:\n\nExample: how to detect remote service shutdown\n\n```javascript\nservice.on('connection', function (socket) {\n  socket.once('close', function () {\n    console.log('the service is most likely dead now');\n  });\n});\n```\n\n### Event: error\n\nIf an `error` occurres in the `server` or between establing a `TCP` connection\nand the actuall `connection` event the `error` event will emit. Be aware that\nif no `error` handler exist the error will be throwen.\n\nExample: on one way to handle errors (but almost like just throwing)\n\n```javascript\nservice.on('error', function (err) {\n  console.error(err.stack);\n\n  // oh no, an error we better just close the service\n  service.close(function () {\n\n    // if anything else is running, then it won't be shutdown gracefully\n    process.exit(1);\n  });\n});\n```\n\n### Event: listening\n\nOnce the service is online this event will emit, note that calling\n`service.address()` is quite useless if this event hasn't been emitted.\n\n### Event: close\n\nThe service is now closed dude to a `service.close` call.\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.2.0","dist":{"shasum":"b06d5fef6e346dbfa20afd790d58657141100fa1","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.2.0.tgz","integrity":"sha512-PjzPP4Bs6JI7HZS7oBNh3G8kAGg74nrFU5AglGKoTwNIptbX00GQbMCR9luoXPeVRfGUcB17GRIkCE0IzKqg3g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDZ/XONPTrrdn/fq1VTGcKHOHaGQp0bhRUyNB5u2WcwNQIgRRh8cFl6Dnx1g3QRAkBPBiwKM/v5/IaGL2uk31ZWRJo="}]},"_npmVersion":"1.1.69","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}]},"0.2.1":{"name":"tcpnet","description":"Creates TCP connections between nodes without configuration","version":"0.2.1","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"main":"./tcpnet.js","scripts":{"test":"tap ./test/simple/*"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"},"keywords":["tcp","autodiscover","scale","cluster","horizontal","nodes","network","connections","fully connected","share","state","parallel"],"dependencies":{"mdns":"1.1.x","isme":"0.3.x","gmid":"0.3.x","async":"0.1.x","interface-name":"0.2.x"},"devDependencies":{"tap":"0.3.x"},"license":"MIT","engines":{"node":"0.8","npm":"1"},"readme":"#tcpnet\n\n> Creates TCP connections between nodes without configuration.\n\n## Installation\n\n```sheel\nnpm install tcpnet\n```\n\nIf the module dosn't work checkout the `node-mdns` [install instructions](https://github.com/agnat/node_mdns#installation).\n\n## Example\n\n```javascript\nvar tcpnet = require('tcpnet');\n\n// Create a service called my-cluster, for every TCP connection\n// pipe the output to the terminal\nvar service = tcpnet('my-cluster', function (socket) {\n  socket.pipe(process.stdout);\n});\n\n// For every one second send a message to all other services on the network\nvar randomId = require('crypto').randomBytes(6).toString('hex');\nsetInterval(function () {\n  console.log('write to ' + service.connections.length + ' nodes');\n  service.connections.forEach(function (socket) {\n    socket.write('message from ' + randomId  + '\\n');\n  });\n}, 1000);\n\n// Pick a random port, and use all available addresses\nservice.listen(0, '0.0.0.0');\n```\n\nNot startup a few node.js processes with this code, and you will see this:\n\n```shell\n$node demo.js\n\nwrite to 2 nodes\nmessage from a6c953a8c1f1\nmessage from 4eba8c4e76e9\nwrite to 2 nodes\nmessage from a6c953a8c1f1\nmessage from 4eba8c4e76e9\n```\n\n## API documentation\n\n> In more detail this is a module for creating a [fully connected](http://en.wikipedia.org/wiki/File:NetworkTopology-FullyConnected.png)\nnode cluster, that means that each node is aware of all other running nodes by\na TCP connection. For the time being this is limited to a local network, that\nmeans you can't connect nodes across the internet, however connection nodes\non a local network (switch or router) works perfectly. But thoughts are being\nmade.\n\n### service = tcpnet(settings, [connection])\n\nThis function creates a new service instance.\n\nThe `settings` argument is required and can be a `string` or an `object`.\nStarting with the `string` case. This is the name of the service and is\nthe only thing there must be shared between all services (nodes).\n\nExample: this code creates two services, they share the same name so they\nwill automaticly be connected.\n\n```javascript\nvar serviceA = tcpnet('my-cluster');\n    serviceA.listen();\n\nvar serviceB = tcpnet('my-cluster');\n    serviceB.listen();\n```\n\nThe `settings` argument can also be an `object`, this provides some more\noptions, there are given by the following paramenters:\n\n* `name` required - exactly the same as the `string` case.\n* `uuid` optional - each service instance **must** have a unique ID,\n if two service instances share the same connection they can't connect\n and may not be able to reach all other servies, with diffrent IDs.\n By default the uuid is created by the [gmid](https://github.com/AndreasMadsen/gmid)\n module. Note there are two requirements for the uuid. One, it must be a\n hexidecimal string (e.g. `BADA55`). Two, they all ids must have a fixed\n length (e.g. `AA` and `CCCCCC` won't work).\n\nThe next argument `connection` is a optional function there if given, will\nbe added as a `connection` event handler.\n\nExample: this code will do the same as the one below:\n\n```javascript\nvar service = tcpnet('my-cluster', function (socket) {\n  // do something with the TCP socket\n});\n\nservice.listen();\n```\n\n```javascript\nvar service = tcpnet('my-cluster');\n\nservice.on('connection', function (socket) {\n  // do something with the TCP socket\n});\n\nservice.listen();\n```\n\n### service.listen([port], [address], [callback])\n\nThe first argument `port` is no big surprise, its the port that the\nservice will use to receive other connections. By default `port` is `0`\nwhich is just a random available `port` assigned by the OS.\n\nThe second argument `address` is the address you want to listen on, by\ndefault `address` is `0.0.0.0` which is all available addresses (localhost\nand public). Do also note that `address` can be a domain (e.q. `localhost`), it\nwill just be resoved to a IP address by a DNS lookup.\n\nExample: 3 ways to listen on only the loopback interface.\n\n```javascript\nservice.listen(0, '127.0.0.1');\nservice.listen(0, '::1');\nservice.listen(0, 'localhost');\n```\n\n_NOTE: because there apear to be a bug in `MDNS` a public only address\n(e.q. `192.168.0.198`) is not allowed, if you wan't the service to be public\nyou will have to use `0.0.0.0` for the time being._\n\nThe third argument `callback` is just an `listening` event handler.\n\n```javascript\nservice.listen(function () {\n  console.log('service is ready');\n});\n```\n\n### service.address()\n\nThis method will return an object containing two properties:\n\n* `port`\n* `addresses`\n\nNOTE: do not use this before the `listening` has emitted, if you do so it will\nreturn `null`.\n\nExample: show the port and addresses that the service is listening on:\n\n```javascript\nservice.listen(0, '0.0.0.0', function () {\n  console.log('service is ready and listening on:');\n\n  var info = service.address();\n  info.addresses.forEach(function (address) {\n    console.log('- ' + address + ':' + info.port);\n  });\n});\n\n/*  Output could be:\n * - 127.0.0.1:52740\n * - 192.168.0.198:52740\n * - ::1:52740\n * - fe80::5ab0:35ff:fe84:84b1:52740\n*/\n```\n\n### service.connections\n\nThis is a dynamic array containing all online sockets. This means that sockets\nwill be added once the `connection` event fires and removed once socket `close`\nevent fires.\n\nExample: multicast a single message from this service to all other online\nservices.\n\n```javascript\nservice.connections.forEach(function (socket) {\n  socket.write('hallo message to you from me\\n');\n});\n```\n\n### service.close([callback])\n\nThis method will close the service and call `socket.end()` on all online\nconnections.\n\nThe optional `callback` arguments will be assigned as an `close` event handler.\n\n```javascript\nservice.close(function () {\n  // everything related to the service is now closed, unless there are other\n  // this running node will automaticly shutdown this process.\n});\n```\n\n### Event: connection\n\nThis event is emitted once a new socket becomes online, to detect the when\nis offline use the socket `close` event:\n\nExample: how to detect remote service shutdown\n\n```javascript\nservice.on('connection', function (socket) {\n  socket.once('close', function () {\n    console.log('the service is most likely dead now');\n  });\n});\n```\n\n### Event: error\n\nIf an `error` occurres in the `server` or between establing a `TCP` connection\nand the actuall `connection` event the `error` event will emit. Be aware that\nif no `error` handler exist the error will be throwen.\n\nExample: on one way to handle errors (but almost like just throwing)\n\n```javascript\nservice.on('error', function (err) {\n  console.error(err.stack);\n\n  // oh no, an error we better just close the service\n  service.close(function () {\n\n    // if anything else is running, then it won't be shutdown gracefully\n    process.exit(1);\n  });\n});\n```\n\n### Event: listening\n\nOnce the service is online this event will emit, note that calling\n`service.address()` is quite useless if this event hasn't been emitted.\n\n### Event: close\n\nThe service is now closed dude to a `service.close` call.\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","readmeFilename":"README.md","_id":"tcpnet@0.2.1","dist":{"shasum":"08ce98b173f7c58f87ff6f179450c47c411020f3","tarball":"https://registry.npmjs.org/tcpnet/-/tcpnet-0.2.1.tgz","integrity":"sha512-fy8cuxfx5JrTvFqix4sSENoYU/QFzbo8COBV/QN6m0LDxog4ZZs/rIaUTedIUiuW6vAHD2A0mQS1Pqfu1Vnnqw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCR01etZNzxe6hbisk4A7vVlSF51jgWCgLDJeZJ3xQexwIgWPadbuonAD8VQX3YJ8g/FSIjDv5+o1Pw8JMZT+3TnoQ="}]},"_npmVersion":"1.1.70","_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}]}},"readme":"#tcpnet\n\n> Create a autodiscover horizontal scaleable tcp cluster\n\n##Mad since\n\nI have hacked to much vertical single OS cluster software, time for a change!\n\n#API\n\n```javascript\nvar tcpnet = require('./tcpnet.js');\nvar uuid = require('node-uuid');\n\nvar create = new Array(32);\n    uuid.v1(null, create, 0);\n    uuid.v4(null, create, 16);\n\nvar service = tcpnet({\n    port: 0, // random\n    host: '0.0.0.0', // everything\n    name: 'custom-name',\n    uuid: create.join('')\n});\n\n// collection of sockets\nservice.on('connection', function (socket) {\n  socket.pipe(process.stdout, {end: false});\n});\n\n// write a message every 100 ms to all other services with same name\nvar randomId = Math.random().toString(10).slice(2);\nsetInterval(function () {\n    console.log('write to ' + service.connections.length + ' worker');\n    service.connections.forEach(function (socket) {\n      socket.write('message from ' + randomId  + '\\n');\n    });\n}, 1000);\n\n// not really nessarry since this is a auto discovery service\nservice.once('listening', function () {\n    var addr = service.address();\n    console.log('opened on: ' + addr.address + ':' + addr.port);\n});\n```\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"time":{"modified":"2022-06-27T04:16:28.374Z","created":"2012-12-02T10:18:37.466Z","0.1.0":"2012-12-02T10:18:50.204Z","0.1.1":"2012-12-02T13:27:01.935Z","0.1.2":"2012-12-02T17:18:34.918Z","0.1.3":"2012-12-09T16:15:37.886Z","0.1.4":"2012-12-10T22:24:48.573Z","0.1.5":"2012-12-11T11:26:18.365Z","0.1.6":"2012-12-11T22:56:13.629Z","0.1.7":"2012-12-12T20:47:35.559Z","0.1.9":"2012-12-14T19:29:47.841Z","0.1.10":"2012-12-16T13:22:50.170Z","0.1.11":"2012-12-16T18:20:01.448Z","0.1.12":"2012-12-16T19:39:40.035Z","0.1.13":"2012-12-16T19:51:41.677Z","0.2.0":"2012-12-30T16:10:33.137Z","0.2.1":"2013-01-06T11:05:37.323Z"},"author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"repository":{"type":"git","url":"git://github.com/AndreasMadsen/tcpnet.git"}}