Re: [nodejs] How to be sure in delivering data between server and client?

61 views
Skip to first unread message

Ben Noordhuis

unread,
Nov 15, 2012, 9:52:19 AM11/15/12
to nod...@googlegroups.com
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.

P. Douglas Reeder

unread,
Nov 19, 2012, 11:26:11 AM11/19/12
to nod...@googlegroups.com
I suggest using Fiddler or another web debugging proxy to capture correct and incorrect interactions, and write integration tests using that data.

greelgorke

unread,
Nov 19, 2012, 5:18:53 PM11/19/12
to nod...@googlegroups.com
server code would be nice.


Am Donnerstag, 15. November 2012 10:56:30 UTC+1 schrieb greeka:
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)?
Reply all
Reply to author
Forward
0 new messages