I hope this helps you . When sending to the network, you can use a single call to write(). If there's not enough buffer space in the kernel for the whole thing, write() will block until it's able to process all of it. You can also write it in chunks, that's fine as well. It doesn't really matter. When reading from the network, you have to call read() in a loop. The buffer size you specify when calling read() is just the maximum it's allowed to return, it won't wait for that much to be received. So it can (and often does) return less than this. Just keep calling read() until it returns 0 to indicate EOF, writing each buffer to the file.
What is the best way to communicate between client socket and server socket which suppors multiple types of action?
Any of those help This happens because the subscription is not destroyed when the component is. In fact, you introduce by that a memory leak because your component cannot be collected by garbage collector until the event exists. You have two options to fix that:
How to send multiple client using socket.id that are connected to socket (Nodejs, Socket.io)
hop of those help? , Feel free to use my Socket.IO Cheatsheet!
// Socket.IO Cheatsheet
// Add socket to room
// Remove socket from room
// Send to current client
socket.emit('message', 'this is a test');
// Send to all clients include sender
io.sockets.emit('message', 'this is a test');
// Send to all clients except sender
socket.broadcast.emit('message', 'this is a test');
// Send to all clients in 'game' room(channel) except sender
socket.broadcast.to('game').emit('message', 'this is a test');
// Send to all clients in 'game' room(channel) include sender
io.sockets.in('game').emit('message', 'this is a test');
// Send to individual socket id
io.sockets.socket(socketId).emit('message', 'this is a test');