powered by Jive Software

Help please... I''ve got a thread problem

Hi there!

I’'m having a problem with sending messages to a telnet client.

I have two users login the jabber server. One is using a telnet and the other one is my java application.

My java application is trying to send a message to the other client but the telnet client does not receive the message.

The code below has a sort of a link list containing the XMPPConnection objects.

res.get2() //Returns a XMPPConnection

My code snippets:

import java.io.*;

import java.util.*;

import java.sql.*;

import java.util.Date;

import org.jivesoftware.smack.*;

import java.text.SimpleDateFormat;

public class Handler

public synchronized boolean sendMethod(String phone, String destEmail, String message, String servicecode)

{

try{

String hostName = res.get2().getHost();

String userName = res.get2().getUsername();

System.out.println("\nHost name : " + hostName + "\nUsername : " + userName + "\ndestEmail : " + destEmail + "\nIsConnected : " + res.get2().isConnected());

res.get2().createChat(destEmail).sendMessage(message);

} // try

catch(XMPPException e){

}

return (sendMethodStatus);

}

}

My problem here is that res.get2() returns the right XMPPConnection object. It sends the message to the server but my telnet client could not get the message.

Am I doing it wrong?

Thanks very much

How is your telnet client listening for messages? One confusing point is that creating two Chat objects between users won’‘t let them “hook up” automatically since each chat will be using a different thread ID. I’'d recommend adding a generic message listener to see if you see messages coming through that way. A mechanism to listen for new chat requests is high on our priority list.

Regards,

Matt

It could also be something as simple as making sure that the telnet client has set its presense to “available”. When a client first logs on the server defaults you to “unavailable” until otherwise notified by the client.

John

Thank you guys for the help.

I got it working!