You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • @Injecteer, I'm not so sure what you try to do...

    The documented code shows that there are two event driven callbacks setup in the (client) connect-callback: on('data',cb1) and on('end',cb2), hence they are BOTH NOT EXECUTED right away. They are executed on respective event driven by the server, where as in your code, (client) socket.end is executed right away - not event driven - while the connect event is still on its way...

    In your code I read that the client is not waiting for data. It just connects, and when the connection is established - connection-callback executed (and socket passed into the callback) - the client sends data and closes the socket.

    The only issue with the documentation is that the comment in the server has a typo: A new client (h)as connected. ;-)

About

Avatar for allObjects @allObjects started