Read here why its a bad idea: http://en.wikipedia.org/wiki/OSI_model
It has been an accomplishment in computer development in the first decade of networking that you do not base your application on the specifics of particular network transport, or at least as little as possible, even tough TCP/IP has become the lingua franca. If you want to quench out the very most of every byte on the cable, you'll have to do UDP and make your own transmission control protocoll on that like some realtime games do. But be warned, its a far way until you get even near as good as TCP comes by default, and you will understand how non trivial things become and what TCP does everything for you. Like for example UDP/TCP packets can be split into several along the transport by a router, and you may receive the ACKs out of order. But I suppose its like prematurely optimizing your application before your run a profiler, do this crazy optimizations when it becomes an actual bottleneck before wasting time and energy on something to make it very complex and an incompatible customization, when it eventually turns out to be of little gain. On Fri, Apr 20, 2012 at 4:55 PM, David Fooks <[email protected]> wrote: > Ok, my bad sorry, it just seems really stupid to have to implement my own > system for something that TCP is already doing. I'll go implement an ACK > system. > > Thanks > > > On Friday, 20 April 2012 12:17:32 UTC+1, David Fooks wrote: >> >> TCP has a whole ACK system built in so there must be a way to know that >> the receiving machine has my message. But none of the three options for this >> seem to change when the ACKs should no longer be received (when I pull the >> connections cable out): >> >> The three things I tried are: >> >> The return value of the socket.write(...) call which is always true even >> when the connection is lost. >> The callback of the socket.write(..., cb) call which is always called even >> the connection is lost. >> The event of the socket.on('drain') call which is always triggered even >> the connection is lost. >> >> How I'm I supposed to know when messages have not been received? The only >> way I can see is to implement my own ACK system. But TCP has an ACK system >> implementing my own will double the network load! I should be told once my >> message has arrived at its recipient. >> >> Btw, I know about keepalives but they will only tell me that I have lost >> my connection but not what messages have been lost. >> >> Does anybody know how to do this? > > -- > 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 -- 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
