Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save koichik/864483 to your computer and use it in GitHub Desktop.
Save koichik/864483 to your computer and use it in GitHub Desktop.
Document net.Socket() constructor
From ec7a4dd27c7bf9318cff02390cbf379c8432e763 Mon Sep 17 00:00:00 2001
From: koichik <koichik@improvement.jp>
Date: Fri, 11 Mar 2011 02:15:05 +0900
Subject: [PATCH] Document net.Socket() constructor
---
doc/api/net.markdown | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/doc/api/net.markdown b/doc/api/net.markdown
index 25b9f92..e3321e0 100644
--- a/doc/api/net.markdown
+++ b/doc/api/net.markdown
@@ -163,6 +163,21 @@ and passed to the user through the `'connection'` event of a server.
`net.Socket` instances are EventEmitters with the following events:
+#### new net.Socket([options])
+
+Construct a new socket object.
+
+`options` is an object with the following defaults:
+
+ { fd: null
+ type: null
+ allowHalfOpen: false
+ }
+
+`fd` allows you to specify the existing file descriptor of socket. `type`
+specified underlying protocol. It can be `'tcp4'`, `'tcp6'`, or `'unix'`.
+About `allowHalfOpen`, refer to `createServer()` and `'end'` event.
+
#### socket.connect(port, [host], [callback])
#### socket.connect(path, [callback])
--
1.7.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment