On Fri, Sep 7, 2012 at 9:09 AM, Ben Noordhuis <[email protected]> wrote:
The client queues write requests until the connection handshake is
> done. Said handshake is complete when the server accepts the
> connection, which node does right before it calls your connListener
> function.
If that is true then why is the first message from the client lost if I do
this?
Note that on my machine (OSX) the message is lost if the timeout is 2 ms or
more, but not if it is less than 2.
Maybe the client queues write requests until the connListener function
completes.
server.js
var net = require('net');
function dataListener(data) {
console.log('received', data.toString());
}
function connListener(socket) {
setTimeout(function () {
socket.on('data', dataListener);
}, 2);
}
var server = net.createServer(connListener);
server.listen(8019);
client.js
var net = require('net');
var socket = net.connect(8019);
socket.write('Is this lost?');
--
R. Mark Volkmann
Object Computing, Inc.
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en