Bad JID's and Failed Sends (and how to detect them)

So I’m working on my first Jabber client for some event messaging and trying to figure things out. We have a simple message listener up and running. However we ran into two issues that have confounded us:

1.) We can evidently send to bad JID’s with no warning. Is there a way to confirm that your sending to a “good” JID?

2.) Is there a way to “time out” a message? We found a way of confirming that a message is received…but not the opposite.

Current code is (roughly):

ConnectionConfiguration config = new ConnectionConfiguration(address,port);

connection = new XMPPConnection(config);


connection.login(userName, passWord);

Message msg = new Message();




I noted that there is a ChatManager…by not using it are we losing the functionality that we desire?

  1. Retrieve it from a Roster

  2. What do you mean by time out? The message is sent asynchronously when you do a sendPacket.

TheChatManager and Chat is the wya to go if you are trying to carry on aconversational type of communication between two endpoints. Itcontains a thread id to relate messages from both endpoints.

This unfortunately doesn’t help since the UID of the target is set externally. In this scenerio I want the API to confirm that the target JID is correct. Pulling from a roster really doesn’t confirm that since it is set (and I believe can be set with bad JIDs, right?).

I also understand that the responses are asynchronous, but where a JID doesn’t really exist any delivery is impossible, yes? In that scenerio, from what I understand of the spec a “recipiant-unavailable” or “remote-server-not-found” should be given ( yes?

I’m not entirely sure where, how, or if these actually get triggered. I’m hoping that they at least get triggered with the ChatManager which we will experiment with shortly.

It sounds accurate enough, but I have never tried that scenario myself. Typically you will want to register some sort of listener for the error message, which is probably being sent but you simply aren’t processing it.

Have you tried turning on the debug console to see if you are receiving the error packet? You can run your program with the vm argument -Dsmack.debugEnabled=true and it will display all communications between your client and the server.