mirror of https://github.com/nodejs/node.git
doc: clarify factory methods for net.Socket
parent
53b4accb6e
commit
70cc9968f6
|
@ -53,9 +53,13 @@ Use `nc` to connect to a UNIX domain socket server:
|
||||||
## net.connect(options, [connectionListener])
|
## net.connect(options, [connectionListener])
|
||||||
## net.createConnection(options, [connectionListener])
|
## net.createConnection(options, [connectionListener])
|
||||||
|
|
||||||
Constructs a new socket object and opens the socket to the given location.
|
A factory method, which returns a new ['net.Socket'](#net_class_net_socket)
|
||||||
|
and connects to the supplied address and port.
|
||||||
|
|
||||||
When the socket is established, the ['connect'][] event will be emitted.
|
When the socket is established, the ['connect'][] event will be emitted.
|
||||||
|
|
||||||
|
Has the same events as ['net.Socket'](#net_class_net_socket).
|
||||||
|
|
||||||
For TCP sockets, `options` argument should be an object which specifies:
|
For TCP sockets, `options` argument should be an object which specifies:
|
||||||
|
|
||||||
- `port`: Port the client should connect to (Required).
|
- `port`: Port the client should connect to (Required).
|
||||||
|
@ -106,6 +110,8 @@ Creates a TCP connection to `port` on `host`. If `host` is omitted,
|
||||||
The `connectListener` parameter will be added as an listener for the
|
The `connectListener` parameter will be added as an listener for the
|
||||||
['connect'][] event.
|
['connect'][] event.
|
||||||
|
|
||||||
|
Is a factory method which returns a new ['net.Socket'](#net_class_net_socket).
|
||||||
|
|
||||||
## net.connect(path, [connectListener])
|
## net.connect(path, [connectListener])
|
||||||
## net.createConnection(path, [connectListener])
|
## net.createConnection(path, [connectListener])
|
||||||
|
|
||||||
|
@ -113,6 +119,8 @@ Creates unix socket connection to `path`.
|
||||||
The `connectListener` parameter will be added as an listener for the
|
The `connectListener` parameter will be added as an listener for the
|
||||||
['connect'][] event.
|
['connect'][] event.
|
||||||
|
|
||||||
|
A factory method which returns a new ['net.Socket'](#net_class_net_socket).
|
||||||
|
|
||||||
## Class: net.Server
|
## Class: net.Server
|
||||||
|
|
||||||
This class is used to create a TCP or UNIX server.
|
This class is used to create a TCP or UNIX server.
|
||||||
|
|
Loading…
Reference in New Issue