On Thu, Nov 15, 2012 at 10:56 AM, greeka <
gre...@gmail.com> wrote:
> I have TCP server written in NodeJS and clients on flash. The communications
> between clients and server builded ower my own protocol (small commands -
> max 50 bytes per command). But some time (aprox 10% from total commands sent
> from server to client) we lost the data. And I can't understand why and
> can't understand the relationship of what is happening. Some time it's
> happens right after connections to client, some time after a couple minutes
> after connect. Some time all ok. No any disconnects or error.
> So my questions:
> - how to be 100% sure that all data is delivered to client (by NodeJS side)?
By having the client send an ACK upon receipt, i.e. have it send a "I
have received your message #22" reply to the server. If you don't
receive the reply in a timely fashion, assume the connection has timed
out.
TCP connections eventually timeout by themselves but that can take a
long time, on the order of hours.
> - if previous is impossible, how to check that my command is delivered?
>
> How to understand and when to use:
>
> socket.setTimeout(timeout, [callback])
> socket.setNoDelay([noDelay])
> socket.setKeepAlive([enable], [initialDelay])
>
>
> Could these methods help me?
>
> P.s. It's our dev server with couple of clients. The network is stable, ping
> 100%.
> Sorry for my English.