You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constserver=createServer((socket)=>{socket.on('end',()=>{console.log('end');});socket.on('close',()=>{console.log('close');});// Without this handler 'end' and 'close' event cannot be emited.// socket.on('data', (data) => {// console.log(data.toString());// });})server.listen(8080);
That's expected, you have to read all the buffered data before the 'end' event is emitted. If you don't want to add a listener for the 'data' event, you can resume the socket.
Server code:
Client code:
If there is not 'data' event handler in server code, client.end cannot emit 'end' or 'close' event of server.
The text was updated successfully, but these errors were encountered: