Le 3/8/13 2:02 PM, Geronimoo CB a écrit :
> Hiya
>
> This is my code
>
>                 try {
>                     WriteFuture writeFuture = session.write(cachedMessage);
>                     writeFuture.addListener(this);
>                     writeFuture.awaitUninterruptibly();
>                     sentMessage = writeFuture.isWritten();
>                 } catch (Exception e) {...
>
>
> Before sending a message, I disconnect the server from the network (pull
>  cable) so that the message cannot possibly be sent. However, 
> sentMessage will return true anyway. On wiresharks output you can see 
> three TCP Retransmissions (and obviously no acks). After a few more 
> messages (not the same message as the first) it will realize the link is
>  down and return false.
>
> How do I get to know that the message was not sent?

The writeFuture just inform you that the message has been pushed in the
socket. That does not mean it has been received by the peer.

The thing is that when you pull the peer cable, the server won't be
informed about it, so the server "thinks" that the connection is still
opened. There is absolutely nothing we can do about that, it's the way
TCP works.




-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 

Reply via email to