62
62
"textRaw": "net.createConnection(options, [connectionListener])",
64
64
"name": "createConnection",
65
"desc": "<p>Constructs a new socket object and opens the socket to the given location.\nWhen the socket is established, the ['connect'][] event will be emitted.\n\n</p>\n<p>For TCP sockets, <code>options</code> argument should be an object which specifies:\n\n</p>\n<ul>\n<li><p><code>port</code>: Port the client should connect to (Required).</p>\n</li>\n<li><p><code>host</code>: Host the client should connect to. Defaults to <code>'localhost'</code>.</p>\n</li>\n<li><p><code>localAddress</code>: Local interface to bind to for network connections.</p>\n</li>\n</ul>\n<p>For UNIX domain sockets, <code>options</code> argument should be an object which specifies:\n\n</p>\n<ul>\n<li><code>path</code>: Path the client should connect to (Required).</li>\n</ul>\n<p>Common options are:\n\n</p>\n<ul>\n<li><code>allowHalfOpen</code>: if <code>true</code>, the socket won't automatically send\na FIN packet when the other end of the socket sends a FIN packet.\nDefaults to <code>false</code>. See ['end'][] event for more information.</li>\n</ul>\n<p>The <code>connectListener</code> parameter will be added as an listener for the\n['connect'][] event.\n\n</p>\n<p>Here is an example of a client of echo server as described previously:\n\n</p>\n<pre><code>var net = require('net');\nvar client = net.connect({port: 8124},\n function() { //'connect' listener\n console.log('client connected');\n client.write('world!\\r\\n');\n});\nclient.on('data', function(data) {\n console.log(data.toString());\n client.end();\n});\nclient.on('end', function() {\n console.log('client disconnected');\n});</code></pre>\n<p>To connect on the socket <code>/tmp/echo.sock</code> the second line would just be\nchanged to\n\n</p>\n<pre><code>var client = net.connect({path: '/tmp/echo.sock'},</code></pre>\n",
65
"desc": "<p>Constructs a new socket object and opens the socket to the given location.\nWhen the socket is established, the ['connect'][] event will be emitted.\n\n</p>\n<p>For TCP sockets, <code>options</code> argument should be an object which specifies:\n\n</p>\n<ul>\n<li><p><code>port</code>: Port the client should connect to (Required).</p>\n</li>\n<li><p><code>host</code>: Host the client should connect to. Defaults to <code>'localhost'</code>.</p>\n</li>\n<li><p><code>localAddress</code>: Local interface to bind to for network connections.</p>\n</li>\n</ul>\n<p>For UNIX domain sockets, <code>options</code> argument should be an object which specifies:\n\n</p>\n<ul>\n<li><code>path</code>: Path the client should connect to (Required).</li>\n</ul>\n<p>Common options are:\n\n</p>\n<ul>\n<li><code>allowHalfOpen</code>: if <code>true</code>, the socket won't automatically send\na FIN packet when the other end of the socket sends a FIN packet.\nDefaults to <code>false</code>. See ['end'][] event for more information.</li>\n</ul>\n<p>The <code>connectListener</code> parameter will be added as an listener for the\n['connect'][] event.\n\n</p>\n<p>Here is an example of a client of echo server as described previously:\n\n</p>\n<pre><code>var net = require('net');\nvar client = net.connect({port: 8124},\n function() { //'connect' listener\n console.log('client connected');\n client.write('world!\\r\\n');\n});\nclient.on('data', function(data) {\n console.log(data.toString());\n client.end();\n});\nclient.on('end', function() {\n console.log('client disconnected');\n});</code></pre>\n<p>To connect on the socket <code>/tmp/echo.sock</code> the second line would just be\nchanged to\n\n</p>\n<pre><code>var client = net.connect({path: '/tmp/echo.sock'});</code></pre>\n",