How to know whether message was sent?

try{
    /********at this moment network became slow or failures*******/
    chat.sendMessage(e.getMessage());
    log.info("Message was sent: " + e);
} catch (XMPPException ex){
    log.error("Error: " + e + ", ex=" + ex);
}

Hi! I’m using smack and openfire, I want to put a loading gif besides the message body on the client screen, if the message was sending it shows loading and when sent it will disappear, so how to know whether message was sent or not?

You will need XEP-198: Stream Management in order to know when the stanza was received by the clients server. This requires support by the server.

Or you could use XEP-184 Message Delivery Receipts to get a receipt when the message was received by the recipient. This requires support by the recipients client.

Thanks for the reply, does openfire support Stream Management? Can you please post a piece of code with implementation of smack ? Thanks!