Could not get receive message,

Hi, I could not get receive message, somebody can tell me, what happle???


public class Frame1

extends JFrame {

BorderLayout borderLayout1 = new BorderLayout();

XMPPConnection connection = null;

public Frame1() {

try {

jbInit();

d();

}

catch (Exception exception) {

exception.printStackTrace();

}

}

private void d() {

try {

XMPPConnection.DEBUG_ENABLED = true;

SSLXMPPConnection.DEBUG_ENABLED = true;

connection = new XMPPConnection(“127.0.0.1”);

connection.login(“XXX”, “XXX123”);

PacketFilter filter = new PacketTypeFilter(Message.class);

PacketListener listener = new PacketListener() {

public void processPacket(Packet packet) {

Message message = (Message) packet;

if(packet instanceof Message){

System.out.println(“SSSSS”);

}

}

};

connection.addPacketListener(listener, filter);

connection.sendPacket(new Presence(Presence.Type.AVAILABLE));

}

catch (XMPPException ex) {

ex.printStackTrace();

}

}

private void jbInit() throws Exception {

getContentPane().setLayout(borderLayout1);

}

public static void main(String[] args) {

Frame1 frame1 = new Frame1();

frame1.pack();

}

}

Hello,

After successful login, you will need to start a process like start a chat session etc?Then you will start receiving message packets.

Vivek

I try to modify “connection.sendPacket(new Presence(Presence.Type.AVAILABLE));”

To become…


Presence p = new Presence(Presence.Type.AVAILABLE);

p.setStatus(“Online”);

connection.sendPacket§;


It’'s work…