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 =-
/*
- Created on February 12, 2005, 4:02 PM
*/
import org.jivesoftware.smack.*;
import java.net.*;
import java.io.*;
/**
*/
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