I have a TCP Server written in node. It accept socket connections, gets 
requests and send response. I use standard socket events like 'data' (to 
read from socket), 'error', 'end', 'drain' and use socket.write() to write 
back the responses to the socket. I have a requirement to provide exact 
count of bytes actually written on the socket (i.e. sent out on the wire). 
For that I use the following at the socket 'end' event.

socket.bytesWritten - socket.bufferSize 

bufferSize is subtracted to account for any bytes that could not be sent 
out before the connection was broken for any reason.

Issue: In some scenarios, wireshark on the server box as well as on the 
client records lot less number of bytes written than what is being 
calculated using (socket.BytesWritten - socket.bufferSize) - in the order 
of few 100Ks. 

So question are 

1. Where all in the node stack can the data be buffered up before it gets 
successfully written out on the socket? 
2. Is there a max size of buffers at each of this layer and are there ways 
to modify them without having to recompile node?
3. Any pointers on where to look at to determine the discrepancy in the 
data sent value calculated in the node app to what is being shown in 
wireshark logs. 

Any insight is appreciated.

Thanks!

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/247e1ae3-c5ac-411c-a11d-9f1ec9c25af0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to