powered by Jive Software

Packets are lost when the connection is down

Hello,

I am facing a problem. Here is the scenario to recreate the problem:

  1. Connect to gtalk server with smack.

  2. Power off the router/modem or unplug the telephone line from the router/modem. This is not same as disabling the connection from control panel or unplugging the network cable.

  3. See that smack client is not aware of the lost connection. Try to send a message with the client. It says that the message sent successfully, and in the smack debugger, message packet is seen as sent.

  4. After some time, smack understands that the connection is lost and tries to reconnect. After that, try to send another message. This time packet is not sent, which is correct.

The problem is, at step 3, some messages are lost. Do you have any idea how to prevent this? Thanks for your help.

P.S.: I do the same test for Google’s gtalk software. It also has the same problem.Do they use smack?

Hi,

Google does not use Smack, so it’s more a TCP/IP problem. As in (3) the connection exists one just needs to send a message which works fine for the application. Also the TCP stack (which has a send buffer) sends one or more packets containing the message without problems, but it will retransmit it over and over as no ACK is received until it decides that the connection is down.

In (4) the connection does not exist, the attempt to create a connection fails as it requires a handshake which fails.

LG

Hi,

Thanks for the reply. Isn’t it possible to understand that the ACK is not received and the message actually is not sent and inform the application by sending the message back to the client containing an error (smack has the ability to do that) so that the untransmitted message is not lost. It is critical for the application we are developing. Thanks.

Hi,

as Smack uses the “internet” API within Java like GTalk uses a C/C++ TCP/IP API it’s no longer in control of the application what happens when the TCP stack did accept the message and I wonder if it’s possible to query the state of the stack for the application.

I would send a confirmation message to confirm the receipt. Probably one can extend the protocol a little bit and add an extra tag which indicates that the receiver must send a confirmation and add a packet listener within Smack which does this.

LG

LG,

Thanks for your help.