I've got a very simple server created using nodejs with 'net' module. I also have a client which connects to it using luasockets. I was testing the connection for like 2 months now, using different connections like 3G, GPRS, WIFI and everything was fine. Client runs on a phone btw. Today, during tests, connected to WIFI, I simply walked from one room to another, and some of the messages sent from server [nodejs, net module using socket.write] were not delivered to my client application. There was no error, no partial message, it simply was lost somewhere. On the server, socket.write() always returns true. Messages are just a few bytes. Like I've said - the server and client app was tested multiple times over 2 months period and this is the first time I saw it. I can reproduce it all the time: message is sent from the server but does not reach client.
My question is.. how can I check where the message was lost? How to troubleshoot this?
EDIT: I was able to run a tcpdump on my router and found that the messages sent do indeed pass the router but they do it with a great delay and they are merged together into a single packet. My tcpdump foo is very limited, and I am not sure what causes the delay. I guess this is because the client was unable to receive the messages, and they were buffered somewhere in between. Anyway, this delay and delivery of messages over such a long period of time makes this unacceptable for me and I have to figure out some way to handle it.
We have decided to add another type of messages to be sent between clients and between client and server to check the connection status. We will use a 1 second timer to send a message from one client to another, if a client does not receive a message longer than 3 seconds they will assume the connection to be interrupted and will send a message to server, to check if the connection with server is ok [just to let the user know where the problem exists].