tags:

views:

220

answers:

1

I am connected to server(Xmpp) but unable to send and receive packets at my psi client

Here is snippet of my code

POSClientIQ posclientiq = new POSClientIQ(); posclientiq.connectXMPPServer(); posclientiq.processMessage(); }

public void processMessage() { try{

  final  IQ iq1 = new IQ() {
 public String getChildElementXML() {
  return "<iq type='get' from ='sam'><query xmlns='jabber:iq:roster'></query></iq>";
}

};

iq1.setType(IQ.Type.GET); // PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(iq1.getPacketID())); connection.sendPacket(iq1);

System.out.println("Message send");

A: 

The getChildElementXML() returns the tag. If you are using Smack then you don't need to write your own IQ implementation unless it is a custom query. For your case, to query the roster use RosterPacket.

Chuk Lee