function echo (socket) { +include("/tcp.js"); +var server = createServer(function (socket) { socket.setEncoding("utf8"); socket.addListener("connect", function () { socket.send("hello\r\n"); @@ -1481,8 +1484,7 @@ on port 7000
diff --git a/doc/api.html b/doc/api.html index d564939739..b396955dbd 100644 --- a/doc/api.html +++ b/doc/api.html @@ -1015,7 +1015,7 @@ Returns a new web server object.
The options argument is optional. The options argument accepts the same values as the -options argument for node.tcp.Server does.
The request_listener is a function which is automatically added to the "request" event.
To use the TCP server and client one must require("/tcp.js") or +include("/tcp.js").
Here is an example of a echo server which listens for connections on port 7000
function echo (socket) { +include("/tcp.js"); +var server = createServer(function (socket) { socket.setEncoding("utf8"); socket.addListener("connect", function () { socket.send("hello\r\n"); @@ -1481,8 +1484,7 @@ on port 7000
"connection"
connection
Emitted when a new connection is made. - connection is an instance of node.tcp.Connection.
"close"
@@ -1554,9 +1556,9 @@ event.
This object is used as a TCP client and also as a server-side -socket for node.tcp.Server.