powered by Jive Software

Problem while registration

Please help, i want to registration to server this is my code …

/* Registration to MSN */

Registration register = new Registration();

register.setType(IQ.Type.SET);

register.setPacketID(“reg2”);

register.setTo(“msn”);

Hashtable map = new Hashtable();

map.put(“username”, Username);

map.put(“password”, Password);

register.setAttributes(map);

// Sent Package

PacketFilter regisfilter = new AndFilter(new PacketIDFilter(register.getPacketID()), new PacketTypeFilter(IQ.class));

PacketCollector collector = con.createPacketCollector(regisfilter);

System.out.println(register.toXML());

con.sendPacket(register);

// collect the response

IQ result = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());

String errorMessage = “”;

if (result == null) {

errorMessage = “Result is Null”;

} else if (result.getType() == IQ.Type.ERROR) {

errorMessage = result.getError().getMessage();

if (errorMessage == null)

errorMessage = “unknownError”;

}

con.login(Username, Password);

/* End of Registration to MSN*/

The error is “java.lang.IllegalStateException: Not connected to server”

what does it mean?