Smack to implement synchronous requests?

hello, i am trying to make a smack client to call a method getDataFromAnotherClient( ), that returns an object directly, instead of sending a message, then catching the reply in the packet listener, is there a clean way to do that using smack api? or i should implement my own synchronized methods to handle the reply… thanks.

Check out packet collectors in the documentation – we created them for just this case. You can setup a packet collector to not return until there’'s a reply waiting (or you can use a timeout).

Regards,

Matt