powered by Jive Software

Delayed Message Delivery

Greetings all,

Warning: I am a newbie for Java and Jabber so this may be an easy question.

My problem is when I generate messages from my SMACK client messages do not get delivered to the user until they logoff and login again. Two real users can communicate with each other in real time, but my program that is using the SMACK API queues up the messages (as if my user was off line) and waits until I login again to dump all of the messages at once to the user.

This does not happen when I use an Internet XMPP server for testing, so I am assuming that it is something unique to the Jive server. In my program I do not check for a status of the other user, or register my presence with the server, are these important in the world of SMACK/Jive?

I’'m using the latest SMACK and Jive (RPM) on debian sarge. Any hints in the right direction would be appreciated.

Thanks,

Adam

Adam,

Can you post a very simple test program that demonstrates the issue? Most likely, there’'s something in your Smack code creating the problem.

Regards,

Matt

Can you post a very simple test program that

demonstrates the issue? Most likely, there’'s

something in your Smack code creating the problem.

This is the whole thing. It’‘s only 3k, I hope that’'s ok.

The idea of the code is to take syslog messages in, and send them to a user (that will eventually go to a SQL server to be parsed). It’‘s not fully commented yet, and I know using IP addresses for the server is a bad thing, but I haven’'t created DNS records yet.

-= Cut and Paste Program Below =-

/*

  • Server514.java
  • Created on February 12, 2005, 4:02 PM

*/

import org.jivesoftware.smack.*;

import java.net.*;

import java.io.*;

/**

  • @author Adam Winnington

*/

public class Server514 {

private DatagramSocket socket;

protected XMPPConnection con;

public Server514() throws XMPPException {

try {

socket = new DatagramSocket( 514 );

}

// process problems creating DatagramSocket

catch( SocketException socketException ) {

socketException.printStackTrace();

System.exit( 1 );

}

try {

con = new XMPPConnection(“10.1.1.9”);

con.login(“kit”, “abc123”);

}

catch( XMPPException xmppException ) {

displayMessage (“Caught Jabber Error”);

System.exit( 1 );

}

} // end Syslog-Server constructor

private void waitForPackets() throws XMPPException

{

while ( true ) { // loop forever

// receive packet, display contents, return copy to client

try {

// set up packet

byte data[] = new byte[ 65000 ];

DatagramPacket receivePacket =

new DatagramPacket( data, data.length );

socket.receive( receivePacket ); // wait for packet

// display information from received packet

displayMessage( “\nPacket received:” +

"\nOrigin: " + receivePacket.getAddress() +

"\nSource port: " + receivePacket.getPort() +

"\nLength: " + receivePacket.getLength() +

“\nInformation:\n\t” + new String( receivePacket.getData(),

0, receivePacket.getLength() ) );

}

// process problems manipulating packet

catch( IOException ioException ) {

displayMessage( ioException.toString() + “\n” );

ioException.printStackTrace();

}

// process XMPP Problems

catch (org.jivesoftware.smack.XMPPException xmppException){

displayMessage (“Caught Jabber Error”);

}

} // end while

} // end method waitForPackets

private void displayMessage( final String messageToDisplay ) throws XMPPException

{

try

{

con.createChat("adam@10.1.1.9")

.sendMessage(messageToDisplay);

}

catch (org.jivesoftware.smack.XMPPException xmppException){

displayMessage (“Caught Jabber Error#2”);

}

}

public static void main( String args[] ) throws XMPPException

{

Server514 application = new Server514();

application.waitForPackets();

}

} //end of Server514

Update:

I have installed the Jive Messenger server on a Windows 2000 server and I get the same results. My program sends messages that are stored in my off line queue then when I login (as a user) I get all the queued messages.

Interesting note though: I’‘m using Exodus and Gush as test clients. When I moved to the new server I had no one on my contact list. I knew the usernames, so I just sent a message to the username on the server. It didn’'t show up until the user logged off and back in. When both users have added each other to the list (and both were “online”) messages were relayed in real time.

Bug? Feature?