Send message not work stably if called in JSP

below is the function snippet i wrote, if i called it in JSP, it works only 50% & no exception(just doesn’'t send the message), could u tell me what mistake i maybe made?

public int sendMsg(String host, String user, String pwd, String recipient, String subject, String content) {

try {

XMPPConnection conn = new XMPPConnection(host);

conn.login(user, pwd);

S

conn.createChat(recipient).sendMessage("[" + subject + "] " + content);

conn.close();

}

catch (Exception e) {

System.out.println(“exception!!!” + e.getMessage());

}

return 0;

}

You just hit a known issue with Smack. The problem is that you are closing the connection immediately after sending a message. For now a possible workaround is to add a delay before closing the connection.

Regards,

– Gato

Thanx a lot, fixed.