Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Please use [highlight=Java] code [/highlight] tags when posting your code.
Forum Tip: Add to peoples reputation by clicking the button on their useful posts.
hello everbody
i installed openfire server on my machine , and i programmed a software with java , an instant messanger interfaces ,( client interfaces and administrator interfaces ) i added this code of smack , but the problem is , i dont know how i am gonna use xmpp protocol to add it to my application so i can communicated the client with the administrator !! can anyone please tell me what i gotta do else to make my project work as an instant messanger !! and thank you again !!
Please start a new thread regarding this issue. The best forum to post in is here - Java Networking
Have you tried getting the example code to work by itself?
Please use [highlight=Java] code [/highlight] tags when posting your code.
Forum Tip: Add to peoples reputation by clicking the button on their useful posts.
hello to everybody
why when i run your program the connection is refused
i did only copy and past!!!!!!
why????
Do you have a server? You can't just run the code I posted without configuring it.
Please use [highlight=Java] code [/highlight] tags when posting your code.
Forum Tip: Add to peoples reputation by clicking the button on their useful posts.
hello
i have a problem to presence notification. this is the code:
public void displayBuddyList() { Roster roster = connection.getRoster(); Collection<RosterEntry> entries = roster.getEntries(); System.out.println("\n\n" + entries.size() + " buddy(ies):"); Presence presence; for(RosterEntry r:entries) { System.out.println(r.getUser()); presence = roster.getPresence(r.getUser()); System.out.println(presence); } }
but my contacts are always unavailable Could you help me? pleaseeeeeeeeeee
somebody help me
hello,
i used this code for jabber client
import java.util.*;
import java.io.*;
import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.RosterEntry;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Message;
public class chat implements MessageListener{
XMPPConnection connection;
public void login(String userName, String password) throws XMPPException
{
//////////ConnectionConfiguration config = new ConnectionConfiguration("im.server.here",5222, "Work");
connection = new XMPPConnection("jabber.org");
connection.connect();
connection.login(userName, password);
}
public void sendMessage(String message, String to) throws XMPPException
{
Chat chat = connection.getChatManager().createChat(to, this);
chat.sendMessage(message);
}
public void displayBuddyList()
{
Roster roster = connection.getRoster();
Collection<RosterEntry> entries = roster.getEntries();
System.out.println("\n\n" + entries.size() + " buddy(ies):");
for(RosterEntry r:entries)
{
System.out.println(r.getUser());
}
}
public void disconnect()
{
connection.disconnect();
}
public void processMessage(Chat chat, Message message)
{
if(message.getType() == Message.Type.chat)
System.out.println(chat.getParticipant() + " says: " + message.getBody());
}
public static void main(String args[]) throws XMPPException, IOException
{
// declare variables
chat c = new chat();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String msg;
// turn on the enhanced debugger
XMPPConnection.DEBUG_ENABLED = true;
// Enter your login information here
c.login("hassan786@jabber.org", "bcsf08m018");
c.displayBuddyList();
System.out.println("-----");
System.out.println("Who do you want to talk to? - Type contacts full email address:");
String talkTo = br.readLine();
System.out.println("-----");
System.out.println("All messages will be sent to " + talkTo);
System.out.println("Enter your message in the console:");
System.out.println("-----\n");
while( !(msg=br.readLine()).equals("bye"))
{
c.sendMessage(msg, talkTo);
}
c.disconnect();
System.exit(0);
}
}
Problem is that
i have made account on jabber.org now if i run the this java programme so if i put my own username and password as well as on console when programme asked that to which user you wanted to connect if i put my own username again than this programme send message and also show on console the recieve message .But if on console i put some other jabber username to which i send message and this user is also online (means run this application on another laptop) but he never recieve the message on his console.
Also explain what parameters i put for jabber account there(new ConnectionConfiguration("im.server.here",5222, "Work")
reply to " swaqpoli " post
presence = roster.getPresence(r.getUser());
after above line try with presense.getStatus();
the same problem i have faced when i am running it on local
but when i run it on our site it runs perfectly. once u try with uploding application into your real website