BSP coded Chat application
Hi
Has anyone ever made a chat application like Gtalk or something in BSP.
Any pointers will be useful.
Kind Regards
Bhavana Advani
Actually there is a SAP Note regarding what designs and everything work on the PDA's if you search this forum you'll find quite a bit on PDA and MOBILE applications.
Similar Messages
-
Call Accept dialog pop up in Chat application
Hello,
I have made an Audio Video chat application in AS3 and using FMS as my server.I want to make the functionality of a call accept dialog box which pops up when one client wants to call another .Giving 2nd client the control to accept call or not like is done in Skype and all.Can anyone explain how will thisbe done using AS3.
Thanx in advance..That would make for a quite a long tutorial, but to give you an idea of some sorts:
1. Keep track of each user that connects so that you can contact them directly
2. Notify the server side from the sending client side that they want to contact somebody, passing in the receiver's unique ID (that you create)
3. Server side figures out which user that is and send them a notification
4. Keep the state of the request on the server and client sides so that you can control how many requests they get etc
5. Respond by the receiver to the server passing back their user ID. The server side code should then go over a hash table of sorts to find out who was trying to contact them (you also have the option of course of just passing around users' IDs so you just pass back the sender's ID too)
6. Get the server to find the sender and respond appropriately.
Check out some tutorials here that cover a lot of server side coding best practices:
http://www.fmsguru.com/tutorials.cfm?tab=fms
That kind of functionality is covered in our chat application product too, but it's not free unfortunately.
Anyways, hope that helps with your question. It's a big deal building that kind of functionality in but can definitely be done with a bit of coding. -
How do i develop a chat application using jms over web based
I want to develop a chat application using jms with mailing,file transfer and audio facilities
can anyone help me to how to go abt thatThere is a good article from Sun on a simple example of what you want - it could serve as a basis for you.
http://developer.java.sun.com/developer/technicalArticles/peer/ -
Hey I'm looking for a specific voice chat application. I would like an app that would allow multiple users to join a chat room and talk via voice with each other on the iphone. I would like this app to also allow users on a PC to join into this voice chat with iphone users. I would also like to make the chat room private so only certain users can join the chat room. Is there an existing application that accomplishes this? I have searched around the internet and haven't found anything yet. Thanks.
Stebalien wrote:Cool! However, the key exchange system looks a little unwieldy; personally, I would give everyone a permanent "identity" key (preferably allow the user to a GPG key) and then use the socialist millionaire's protocol (SMP) to exchange these keys. Once the keys have been exchanged, they can be used to negotiate shared session keys. This way, once you talk to someone once, you don't need to keep manually sharing a key with them. The OTR library (libotr) does this very well but I don't know how usable it would be for this project (it's intended for layering encryption over existing IM protocols).
Really thanx for your interest, i refer to the main developer . Be free to come in #seren on irc.freenode.net , to talk directly with him and the community! -
What are the requirements to build a live video chat application?
I am looking into making a live video chat application. I
have seen several examples on the web so my question is not "how"
to do it. My question is "what do I need" to do it?
It seems that all the examples use Flex Data Services and
then some sort of back-end communication server. The cost of FDS is
well beyond what the client can afford so my question is: is it
necessary? Is there a way to build this sort of application without
FDS? Can I get live video streaming to work using only what is in
the SDK? I know nothing about data streaming, real-time
communication, etc. and have no idea how to implement this outside
what I have seen in the online articles so far.
If there are any other forums that are more appropriate to
this question, please direct me there. It is not a FDS exclusive
issue and I am just starting to look into it. I am starting here
because we would like to use Flash Player for the client-side
application.I am looking into making a live video chat application. I
have seen several examples on the web so my question is not "how"
to do it. My question is "what do I need" to do it?
It seems that all the examples use Flex Data Services and
then some sort of back-end communication server. The cost of FDS is
well beyond what the client can afford so my question is: is it
necessary? Is there a way to build this sort of application without
FDS? Can I get live video streaming to work using only what is in
the SDK? I know nothing about data streaming, real-time
communication, etc. and have no idea how to implement this outside
what I have seen in the online articles so far.
If there are any other forums that are more appropriate to
this question, please direct me there. It is not a FDS exclusive
issue and I am just starting to look into it. I am starting here
because we would like to use Flash Player for the client-side
application. -
Need help regarding develpment of a chat application in java
hi
well, i would like to know what is the best and simple technolgy to develop a simple chat application. I was searching this on internet and found some using servlets and JSP's, applets, RMI etc. I dont know exactly which to use. Infact iam new to java and if someone can help me out with this, i can start reading the specific technology.
Thanks in advance.
ravi.follow this tutorial and you might get some clues: http://java.sun.com/docs/books/tutorial/networking/sockets/index.html
-
Null pointer exception in jsp ,data missing in chat application
Hi all....
I have a chat application in jsp using ajax.I have opened a d/b connection in a jsp which is called each time I sent a message.But sometimes I get null pointer exception in this page when msgs are sent so fast...also I miss some of the msgs I sent....I can't avoid that connection ther..When I commented all those d/b connection statements...everything is working fine..Please suggest me any solution...
Thanks in advance.Hi,
Am not getting exception now.In the jsp wer I ve written connection,am taking some values using request.getParameter("msg") . I had opened the connection statement before getting these parameter values.Think I ws getting null pointer exception due to this.Now I have opened connection after getting these parameter values...anyway am not getting the exception now...
Thanks. -
Urgent need of help with a chat application!
Hi,
I'm writing a Chat Application and I want to add Emoticon, I did so by adding buttons but I don't know how to send the gif to my JTextField and to my JTextArea.
Here is part of my code can someone can help me PLEASE!!!
JPanel chatPane = new JPanel(new BorderLayout());
JPanel emoticon = new JPanel(new GridLayout(2, 5));
b1 = new JButton (sourrire);
b1.setToolTipText("Un Sourire");
// b1.addActionListener();
emoticon.add(b1);
b2 = new JButton (gsourrire);
b2.setToolTipText("Un Grand Sourire");
// b2.addActionListener();
emoticon.add(b2);
b3 = new JButton (triste);
b3.setToolTipText("Triste");
// b3.addActionListener();
emoticon.add(b3);
b4 = new JButton (grimace);
b4.setToolTipText("Grimace");
// b4.addActionListener();
emoticon.add(b4);
b5 = new JButton (pleure);
b5.setToolTipText("Pleure");
// b5.addActionListener();
emoticon.add(b5);
b6 = new JButton (bec);
b6.setToolTipText("Un bec");
// b6.addActionListener();
emoticon.add(b6);
b7 = new JButton (coeur);
b7.setToolTipText("Un coeur pour toi");
// b7.addActionListener();
emoticon.add(b7);
b8 = new JButton (fache);
b8.setToolTipText("Fache");
// b8.addActionListener();
emoticon.add(b8);
b9 = new JButton (lunettes);
b9.setToolTipText("Je suis Cool");
// b9.addActionListener();
emoticon.add(b9);
b10 = new JButton (clinoeil);
b10.setToolTipText("Clin d'Oeil");
//b10.addActionListener(new ActionAdapter2());
emoticon.add(b10);
Thanks a lot!
IsabelleHi anoopjain13
what I did is that each button is an IconImage and I was trying to send the Icon to the textfield.
here is the complete code of my chat, you'll understand better what I tried to do.
//Naziha Berrassil et Isabelle Gosselin
//Travail Pratique #1
//remis � Said Senhaji
//Developpement d'une application CHAT
//package chatv2.a
import java.lang.*;
import java.util.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
public class TCPChat2a implements Runnable {
// Constantes de l'etat de la connection
public final static int NULL = 0;
public final static int DISCONNECTED = 1;
public final static int DISCONNECTING = 2;
public final static int BEGIN_CONNECT = 3;
public final static int CONNECTED = 4;
// Declaration d'un tableau de chaines
public final static String statusMessages[] = {
" Erreur! Aucune connexion possible!", " Deconnexion",
" Deconnexion en cours...", " Connexion en cours...", " Connexion"
//Instentiation de la classe
public final static TCPChat2a tcpObj = new TCPChat2a();
// Indique la fin d'une session
public final static String END_CHAT_SESSION =
new Character((char)0).toString();
// Informations sur l'etat de la connexion
public static String hostIP = "localhost";
public static String user = "";
public static String s1;
public static int port = 1234;
public static int connectionStatus = DISCONNECTED;
public static boolean isHost = true;
public static String statusString = statusMessages[connectionStatus];
public static StringBuffer toAppend = new StringBuffer("");
public static StringBuffer toSend = new StringBuffer("");
// Declaration des composantes GUI et initialisation
public final static ImageIcon sourrire = new ImageIcon ("icons/sourrire.gif");
public static JButton b1;
public final static ImageIcon gsourrire = new ImageIcon ("icons/grand_sourrire.gif");
public static JButton b2;
public final static ImageIcon triste = new ImageIcon ("icons/triste.gif");
public static JButton b3;
public final static ImageIcon pleure = new ImageIcon ("icons/pleure.gif");
public static JButton b4;
public final static ImageIcon coeur = new ImageIcon ("icons/coeur.gif");
public static JButton b5;
public final static ImageIcon grimace = new ImageIcon ("icons/grimace.gif");
public static JButton b6;
public final static ImageIcon lunettes = new ImageIcon ("icons/lunettes.gif");
public static JButton b7;
public final static ImageIcon fache = new ImageIcon ("icons/fache.gif");
public static JButton b8;
public final static ImageIcon bec = new ImageIcon ("icons/bec.gif");
public static JButton b9;
public final static ImageIcon clinoeil = new ImageIcon ("icons/clinoeil.gif");
public static JButton b10;
public static JFrame mainFrame = null;
public static JTextArea chatText = null;
public static JTextField chatLine = null;
public static JPanel statusBar = null;
public static JLabel statusField = null;
public static JTextField statusColor = null;
public static JTextField ipField = null;
public static JTextField username = null;
public static JTextField portField = null;
public static JRadioButton hostOption = null;
public static JRadioButton guestOption = null;
public static JButton connectButton = null;
public static JButton disconnectButton = null;
// Declaration des composantes TCP
public static ServerSocket hostServer = null;
public static Socket socket = null;
public static BufferedReader in = null;
public static PrintWriter out = null;
//Methode qui retourne le premier pannel(optionsPane),ce dernier
//se compose de 5 panneaux
private static JPanel initOptionsPane() {
//pannel pane qui sera ajout� au pannel optionsPane
JPanel pane = null;
//initiation de la classe ActionAdapteur qui implemente ActionListner
ActionAdapter buttonListener = null;
// Creation du pannel optionsPane
JPanel optionsPane = new JPanel(new GridLayout(5, 1));
// 1er pannel pane pour label et textfield de l'adresse IP
pane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
pane.add(new JLabel("Serveur IP:"));
ipField = new JTextField(10);
ipField.setBackground(new Color(0.98f, 0.97f, 0.85f));
ipField.setText(hostIP);
ipField.setEnabled(false);
//evenement generer par Component avec la methode addFocusListener
//en cas d'obtention ou perte du focus par un composant
ipField.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent e) {
ipField.selectAll();
//Editable seulement en mode deconnexion
if (connectionStatus != DISCONNECTED) {
changeStatusNTS(NULL, true);
else {
hostIP = ipField.getText();
pane.add(ipField);
optionsPane.add(pane);
// 2eme pannel pane pour label et textfield du port
pane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
pane.add(new JLabel("Port:"));
portField = new JTextField(10);
portField.setBackground(new Color(0.98f, 0.97f, 0.85f));
portField.setEditable(true);
portField.setText((new Integer(port)).toString());
portField.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent e) {
//Textfield du port modifiable si on est en mode deconnexion
if (connectionStatus != DISCONNECTED) {
changeStatusNTS(NULL, true);
else {
int temp;
try {
temp = Integer.parseInt(portField.getText());
port = temp;
catch (NumberFormatException nfe) {
portField.setText((new Integer(port)).toString());
mainFrame.repaint();
pane.add(portField);
optionsPane.add(pane);
// 3eme pannel pour label et textfield du nom d'utilisateur
pane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
pane.add(new JLabel("Nom: "));
username = new JTextField(10);
username.setBackground(new Color(0.98f, 0.97f, 0.85f));
username.setText(user);
username.setEnabled(true);
username.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent e) {
// username.selectAll();
// Should be editable only when disconnected
if (connectionStatus != DISCONNECTED) {
changeStatusNTS(NULL, true);
else {
user = username.getText();
pane.add(username);
optionsPane.add(pane);
// Host/guest option
buttonListener = new ActionAdapter() {
public void actionPerformed(ActionEvent e) {
if (connectionStatus != DISCONNECTED) {
changeStatusNTS(NULL, true);
else {
isHost = e.getActionCommand().equals("host");
// Cannot supply host IP if host option is chosen
if (isHost) {
ipField.setEnabled(false);
ipField.setText("localhost");
hostIP = "localhost";
else {
ipField.setEnabled(true);
//creation de boutton groupe radio(serveur et invite)
ButtonGroup bg = new ButtonGroup();
hostOption = new JRadioButton("Serveur", true);
hostOption.setMnemonic(KeyEvent.VK_S);
hostOption.setActionCommand("host");
hostOption.addActionListener(buttonListener);
guestOption = new JRadioButton("Invite", false);
guestOption.setMnemonic(KeyEvent.VK_I);
guestOption.setActionCommand("invite");
guestOption.addActionListener(buttonListener);
bg.add(hostOption);
bg.add(guestOption);
// 4eme pannel pane pour les 2 bouttons radio
pane = new JPanel(new GridLayout(1, 2));
pane.add(hostOption);
pane.add(guestOption);
optionsPane.add(pane);
// 5eme pannel buttonPane pour les bouttons de connexion et deconnexion
JPanel buttonPane = new JPanel(new GridLayout(1, 2));
buttonListener = new ActionAdapter() {
public void actionPerformed(ActionEvent e) {
// requete pou debut d'une connexion
if (e.getActionCommand().equals("connect")) {
changeStatusNTS(BEGIN_CONNECT, true);
// Deconnexion
else {
changeStatusNTS(DISCONNECTING, true);
//creation des bouttons dans le pannel et l'ajout au premier pannel
//(optionsPane)
connectButton = new JButton("Connexion");
connectButton.setMnemonic(KeyEvent.VK_C);
connectButton.setActionCommand("connect");
connectButton.addActionListener(buttonListener);
connectButton.setEnabled(true);
disconnectButton = new JButton("Deconnexion");
disconnectButton.setMnemonic(KeyEvent.VK_D);
disconnectButton.setActionCommand("disconnect");
disconnectButton.addActionListener(buttonListener);
disconnectButton.setEnabled(false);
buttonPane.add(connectButton);
buttonPane.add(disconnectButton);
optionsPane.add(buttonPane);
return optionsPane;
// Initialisation de toutes les composantes GUI et affichage du frame
private static void initGUI() {
// Configuration du status bar
// cr�ation d'un autre pannel statusBar qui se compose d'un petit carr�
// color� et un label indiquant le mode de connexion
statusField = new JLabel(); //Label indiquant l'�tat de la connexion
statusField.setText(statusMessages[DISCONNECTED]);
statusColor = new JTextField(1); //carr� color� indiquant l'�tat de la connection grace a des couleurs
statusColor.setBackground(Color.red);
statusColor.setEditable(false);
statusBar = new JPanel(new BorderLayout());
statusBar.add(statusColor, BorderLayout.WEST);
statusBar.add(statusField, BorderLayout.CENTER);
// Configuration du pannel optionsPane en appelant la methode d'initiation
// de ce dernier
JPanel optionsPane = initOptionsPane();
// Creation et configuration du pannel chatPane qui contient un
// textarea au centre avec une barre defilante verticale et un textfield
// au sud pour faire rentrer les messages
JPanel chatPane = new JPanel(new BorderLayout());
JPanel emoticon = new JPanel(new GridLayout(2, 5));
b1 = new JButton (sourrire);
b1.setToolTipText("Un Sourire");
// b1.addActionListener();
emoticon.add(b1);
b2 = new JButton (gsourrire);
b2.setToolTipText("Un Grand Sourire");
// b2.addActionListener();
emoticon.add(b2);
b3 = new JButton (triste);
b3.setToolTipText("Triste");
// b3.addActionListener();
emoticon.add(b3);
b4 = new JButton (grimace);
b4.setToolTipText("Grimace");
// b4.addActionListener();
emoticon.add(b4);
b5 = new JButton (pleure);
b5.setToolTipText("Pleure");
// b5.addActionListener();
emoticon.add(b5);
b6 = new JButton (bec);
b6.setToolTipText("Un bec");
// b6.addActionListener();
emoticon.add(b6);
b7 = new JButton (coeur);
b7.setToolTipText("Un coeur pour toi");
// b7.addActionListener();
emoticon.add(b7);
b8 = new JButton (fache);
b8.setToolTipText("Fache");
// b8.addActionListener();
emoticon.add(b8);
b9 = new JButton (lunettes);
b9.setToolTipText("Je suis Cool");
// b9.addActionListener();
emoticon.add(b9);
b10 = new JButton (clinoeil);
b10.setToolTipText("Clin d'Oeil");
//b10.addActionListener(new ActionAdapter2());
emoticon.add(b10);
emoticon.addActionListener(new ActionAdapter() {
public void actionPerformed(ActionEvent e) {
String image = chatLine.setImage().toString();
appendToChatBox(image);
chatLine.selectAll();
sendString(image)
chatLine.setText(" ");
emoticon.setVisible(true);
//b1 = setVisible(true);
chatText = new JTextArea(10, 100);
chatText.setBackground(new Color(0.98f, 0.97f, 0.85f));
chatText.setLineWrap(true);
chatText.setEditable(false);
chatText.setForeground(Color.blue);
JScrollPane chatTextPane = new JScrollPane(chatText,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
chatLine = new JTextField(10);
chatLine.setBackground(new Color(0.98f, 0.97f, 0.85f));
chatLine.setForeground(Color.blue);
chatLine.setEnabled(false);
chatLine.addActionListener(new ActionAdapter() {
public void actionPerformed(ActionEvent e) {
String s = chatLine.getText();
if (!s.equals("")) {
appendToChatBox(user=username.getText()+" dit : \n" + s + "\n");
chatLine.selectAll();
// Envoi de la chaine entr�e
sendString(s);
chatLine.setText("");
chatPane.add(chatLine, BorderLayout.SOUTH);
chatPane.add(chatTextPane, BorderLayout.NORTH);
chatPane.setPreferredSize(new Dimension(300, 300));
chatPane.add(emoticon, BorderLayout.CENTER);
// Ajout des pannels dans le pannel principal (mainPane)
JPanel mainPane = new JPanel(new BorderLayout());
mainPane.add(statusBar, BorderLayout.SOUTH);
mainPane.add(optionsPane, BorderLayout.WEST);
mainPane.add(chatPane, BorderLayout.CENTER);
// Configuration du frame (mainFrame)
mainFrame = new JFrame("Chat");
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// la m�thode setDefaultCloseOperation(int)provient de la classe javax.swing.JDialog
// Elle specifi l'op�ration qui sera ex�cut�e par d�fault lorsque
// l'utilisateur initialisera une fermeture de session
mainFrame.setContentPane(mainPane);
mainFrame.setSize(mainFrame.getPreferredSize());
// la m�thode getPreferredSize() provient de la classe java.awt
// Retourne la grosseur "pr�f�r�e" du container.
mainFrame.setLocation(200, 200);
// la m�thode setLocation(double, double) provient de la classe java.awt.Point
// elle permet de specifiez un emplacement d'un point a des coordonn�es de type Float
mainFrame.pack();
// la m�thode pack() provient de la class AWT.Window, elle permet a la fenetre
// d'�tre ajuster a la grosseur et a la mise en page des sous-composantes de celle-ci
mainFrame.setVisible(true);
// Le thread qui permet le changement des composantes GUI pendant le
// changement de l'etat
private static void changeStatusTS(int newConnectStatus, boolean noError) {
// Changer l'etat si valide
if (newConnectStatus != NULL) {
connectionStatus = newConnectStatus;
// S'il n'y a aucunes erreur, afficher le bon message de l'etat
if (noError) {
statusString = statusMessages[connectionStatus];
// Autrement, afficher le message d'erreur
else {
statusString = statusMessages[NULL];
System.out.println("Echec lors de la connexion");
// Appel a la routine de run()(Runnable interface) sur la gestion des erreurs
// et la mise a jours des composantes GUI grace au thread
SwingUtilities.invokeLater(tcpObj);
// Le changement des composantes GUI sans aucun pendant le
// changement de l'etat
private static void changeStatusNTS(int newConnectStatus, boolean noError) {
// Changer l'etat si valide
if (newConnectStatus != NULL) {
connectionStatus = newConnectStatus;
// S'il n'y a aucunes erreur, afficher le bon message de l'etat
if (noError) {
statusString = statusMessages[connectionStatus];
// Autrement, afficher le message d'erreur
else {
statusString = statusMessages[NULL];
// Appel a la routine de run()(Runnable interface) sur la gestion des erreurs
// en utilisant le thread
tcpObj.run();
// L'ajout au chat box avec l'utilisation du Thread
private static void appendToChatBox(String s) {
synchronized (toAppend) {
toAppend.append(s);
System.out.println(s);
// Ajouter le text au "send-buffer"
private static void sendString(String s) {
synchronized (toSend) {
toSend.append(user=username.getText()+ " dit : \n" + s + "\n");
// Nettoyage pour le debranchement
private static void cleanUp() {
try {
if (hostServer != null) {
hostServer.close();
hostServer = null;
catch (IOException e) { hostServer = null; }
try {
if (socket != null) {
socket.close();
socket = null;
catch (IOException e) { socket = null; }
try {
if (in != null) {
in.close();
in = null;
catch (IOException e) { in = null; }
if (out != null) {
out.close();
out = null;
// Verification de l'etat courrant et ajustement de "enable/disable"
// en fonction de l'etat
public void run() {
switch (connectionStatus) {
case DISCONNECTED:
connectButton.setEnabled(true);
disconnectButton.setEnabled(false);
ipField.setEnabled(true);
portField.setEnabled(true);
username.setEnabled(true);
hostOption.setEnabled(true);
guestOption.setEnabled(true);
chatLine.setText("");
chatLine.setEnabled(false);
statusColor.setBackground(Color.red);
break;
case DISCONNECTING:
connectButton.setEnabled(false);
disconnectButton.setEnabled(false);
ipField.setEnabled(false);
portField.setEnabled(false);
hostOption.setEnabled(false);
guestOption.setEnabled(false);
chatLine.setEnabled(false);
statusColor.setBackground(Color.orange);
break;
case CONNECTED:
connectButton.setEnabled(false);
disconnectButton.setEnabled(true);
ipField.setEnabled(false);
portField.setEnabled(false);
hostOption.setEnabled(false);
username.setEnabled(false);
guestOption.setEnabled(false);
chatLine.setEnabled(true);
statusColor.setBackground(Color.green);
break;
case BEGIN_CONNECT:
connectButton.setEnabled(false);
disconnectButton.setEnabled(false);
ipField.setEnabled(false);
portField.setEnabled(false);
hostOption.setEnabled(false);
username.setEnabled(false);
guestOption.setEnabled(false);
chatLine.setEnabled(true);
chatLine.grabFocus();
statusColor.setBackground(Color.orange);
break;
// S'assurer que l'etat des champs bouton/texte sont consistent
// avec l'etat interne
ipField.setText(hostIP);
portField.setText((new Integer(port)).toString());
hostOption.setSelected(isHost);
guestOption.setSelected(!isHost);
statusField.setText(statusString);
chatText.append(toAppend.toString());
toAppend.setLength(0);
mainFrame.repaint();
// Procedure principale
public static void main(String args[]) {
String s;
initGUI();
while (true) {
try {
Thread.sleep(10);
// Verification a toute les 10 ms
catch (InterruptedException e) {}
switch (connectionStatus) {
case BEGIN_CONNECT:
try {
// Essai de configuration du serveur si "host"
if(user != ""){
if (isHost) {
hostServer = new ServerSocket(port);
socket = hostServer.accept();
// Si invit�, essai de branchement au serveur
else {
socket = new Socket(hostIP, port);
in = new BufferedReader(new
InputStreamReader(socket.getInputStream()));
out = new PrintWriter(socket.getOutputStream(), true);
changeStatusTS(CONNECTED, true);
System.out.println("Ouverture de la session: \n" + socket);
else{
JOptionPane.showMessageDialog(null, "Erreur, vous devez entrer un nom d'utilisateur", "Erreur", JOptionPane.PLAIN_MESSAGE);
changeStatusTS(DISCONNECTED, false);
// Si erreur, nettoyage et envoi du message d'erreur
catch (IOException e) {
cleanUp();
changeStatusTS(DISCONNECTED, false);
break;
case CONNECTED:
try {
// Envoi de data
if (toSend.length() != 0) {
out.print(toSend);
out.flush();
toSend.setLength(0);
changeStatusTS(NULL, true);
// Reception de data
if (in.ready()) {
s = in.readLine();
if ((s != null) && (s.length() != 0)) {
// Verification de la fin de la transmission
if (s.equals(END_CHAT_SESSION)) {
changeStatusTS(DISCONNECTING, true);
// Autrement, reception du texte
else {
appendToChatBox( s + "\n");
changeStatusTS(NULL, true);
catch (IOException e) {
cleanUp();
changeStatusTS(DISCONNECTED, false);
break;
case DISCONNECTING:
// Dis aux autres fenetre de chat de se d�brancher aussi
out.print(END_CHAT_SESSION);
out.flush();
System.out.println("Fermeture de la session");
// Nettoyage (ferme les streams/sockets)
cleanUp();
changeStatusTS(DISCONNECTED, true);
break;
default: break; // ne fait rien
// Certaines interfaces �couteurs sont accompagn�es d'adaptateurs qui
//implementent toutes les methodes de l'interface et evitent de les lister.
class ActionAdapter implements ActionListener {
public void actionPerformed(ActionEvent e) {}
//////////////////////////////////////////////////////////////////// -
Close a client part of the socket in a chat application
Hy. I have a chat application where the clients connect to the server. For example lets suppose that there are 3 clients connected to the server. I want to make a method that makes the followings : when a client wants to disconnect from the chat application(from the server) he types 'disconnect', and the connection between server and client is interrupted. How can i do this????
Here is the exceptionjava.net.SocketException: Socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.net.SocketInputStream.read(SocketInputStream.java:182)
at java.io.DataInputStream.readInt(DataInputStream.java:370)
at chat.common.network.MessageReader.unserializedMessage(MessageReader.java:38)
at chat.common.network.MessageReader.run(MessageReader.java:29)
at java.lang.Thread.run(Thread.java:619), and MessageReader class is like this
public class MessageReader implements Runnable {
private SynchronizedQueue<IMessage> list;
private DataInputStream in;
private static boolean running = true;
public MessageReader(SynchronizedQueue<IMessage> list, InputStream in) {
this.list = list;
this.in = new DataInputStream(in);
public static void isRunning(boolean isRunning) {
running = isRunning;
public void run() {
try {
while (running) {
IMessage m = unserializedMessage(in);
list.offer(m);
} catch (IOException e) {
e.printStackTrace();
private IMessage unserializedMessage(DataInputStream in) throws IOException {
int type = in.readInt();
IMessage m;
try {
m = MessageFactory.create(type);
} catch (Exception e) {
throw new IOException("userialize exc " + e.getMessage());
m.unserialize(in);
return m;
} This -
Doubts over the Performance in Developing a Chat application
We are developing a chat application which needs to update the chat content in the database for the duration of the chat (ie.,For the duration of a session).At the same time the page should refresh and show the current content on both ends.In addition to both these, the database tables has to be checked to detect the occurence of a Network error on both sides.
We have developed it as a Browser based chat and we have used PHP with MySQL. The performance is slow.
Can anyone give a suggestion as to whether we can develop the chat application completely from the scratch and if we do that which technology should we choose to boost the performance.
If anyone is not clear about my problem just mail me.I'll explain it in more detail.
Thanks in AdvanceHi,
I just wanted to know these following answers.
2) Network failure -- Means (either browswer got killed or data did not arrived/Page Not refreshed)
3) which WebSErver are U using?
From java, it is very easy to develop chatting application for which you can use applet and servlets for the same (if you consider the performance is the utmost importance)
Updating to the database should not be done for the duration levels rather should be done at the event levels(data change/keyboards/session -inf changes).
Im not sure about PHPs running at client but I can suggest you to use two frames .One is for typing and other one is for displaying information which basically gets the staus from the server abt other users in the chat either from the session, which would be driven by other component which is static) .
Any how, I just put my ideas (Im sure , you know all these things)
with regards
Lokesh T.c -
BSP Data Entry Application in a SAP BW System
Would it be unwise to develop a BSP data entry application within a BW system?
The application's purpose in life is to collect data for reporting in BW.
The application would store its data in transactional ODS tables. From there, the data would be extracted and loaded into the InfoCube for analysis and reporting.
Your words of wisdom would be appreciated.
Regards,
Shawn Searcyanniee ,
This is pretty easy , I have done this for my implementation.
Data will be entered from a Web Application back into BW using a BSP.
but this post already has the status as answered .. so a solution has been found ?
or like durai athavan raja has asked .. we could have it as a separate post ... ( then you could give me more points!!!;-) )
Arun
P.S I have done this being a newbie to ABAP and BSP .. so I could give you my code and the experts here could help me in making it better. It works for the moment and no problkems as such...!!! -
OO ABAP and BSP coding standards
Hi,
Can anyone send me the documnet for OO ABAP and BSP coding standards.
Points will be rewarded.
Regards
Sandeep ReddyHi,
Can anyone send me the documnet for OO ABAP and BSP coding standards.
Points will be rewarded.
Regards
Sandeep Reddy -
Recommendations for a simple, fast GUI LAN chat application? [Solved]
We now have 4 ArchLinux machines scattered throughout the house. (My wife is an Archer now!). I am looking for a simple fast GUI LAN chat application. I looked at "qchat" but it is a bit cumbersome and doesn't have the option of a small applet to the panel. Any recommendations appreciated...
Larry
Last edited by lagagnon (2010-02-13 21:27:00)jwwolf wrote:Found this in AUR
griv
I just tried it with a few machines and it works fine.
Excellent choice! Nice, light and unobtrusive. Works well, thanks for the recommendation. -
How to create smileys in a chat application?
Hello, i developped a chat application in java
i use a JFrame, and to put the dialogs, i use a DefaultListModel.
how can i print smileys ?
the defaultlistmodel works for printing String, not pictures.
Can you help me ?Hello, i developped a chat application in java
i use a JFrame, and to put the dialogs, i use a
DefaultListModel.
how can i print smileys ?
the defaultlistmodel works for printing String, not
pictures.When you say your using DefaultListModel I assume your using it with a JList because otherwise its really pointless. You won't do this code in the list model you will have to do it with the JList by making your own renderer. Take a look at this link here is a good example of using an image in a list. I don't think they have text and an image in the same row of the list, but that shouldn't be too hard to add on your own.
http://www.codeguru.com/java/articles/449.shtml -
Video Chat Application : Problem downstream on ios device
Hi
I made real time video chat application between mobile (ios and android device with flash builder 4.7 on flex 4.6.0 and adobe air 15) and flash desktop website (flash builder 4.6, on flex 4.6.0 air 4.0). It's almost done, but there is a problem only ios device subscribe stream is very lag for the first time that video streaming start. Sometime it is stop for several time before it can be play that stream. I find the cause of it such as network, flash desktop build version, buffer (it's very smooth but there is problem when you press home button while using video chat, It's stream is gone T^T)
I have the example of downstream :
// ------------ sample code that using netstream ------------
if(subscribeNetStream == null)
subscribeNetStream = new NetStream(subscribeNetConnection);
trace("Initial for playing agent video")
subscribeNetStream.client = {onMetaData:function(obj:Object):void{}};
// display metadata
var clientMetaData:Object = new Object();
clientMetaData.onMetaData = function(info:Object):void{
trace("onMetaData");
// print debug information about the metaData
for (var propName:String in info){
trace(" "+propName + " = " + info[propName]);
subscribeNetStream.client = clientMetaData;
// trace the NetStream status information
subscribeNetStream.addEventListener(NetStatusEvent.NET_STATUS, subscribeNetStatusHandler);
// set the buffer time to zero since it is chat
subscribeNetStream.bufferTime = 0;
// subscribe to the named stream
subscribeNetStream.play("Stream_name");
// attach to the stream
if(!videoSubscriber){
videoSubscriber = new Video(uicAgent.width, uicAgent.height);
videoSubscriber.attachNetStream(subscribeNetStream);
uicAgent.addChild(videoSubscriber);
------------------- netstream/netconnection handle method ----------------------------
private function subscribeNetStatusHandler(event:NetStatusEvent):void{
trace(event.currentTarget+" : "+event.info.clientid+" : Subscribe netStatus = "+event.info.code+"\n "+event.info.description);
switch(event.info.code) {
case "NetConnection.Connect.Success":
trace("Success to play");
playStream();
break;
case "NetStream.Buffer.Empty" :
if(holdingNetStream)
holdingNetStream.seek(0);
default:
break;
// --------- End of sample code ------------------
I have no idea for solving this problem please suggest me
Thank you
Pornphop SudpanCheck this page out for a list of apps available in a certain region on the PlayBook:
http://btsc.webapps.blackberry.com/btsc/viewdocument.do?noCount=true&externalId=KB27203&sliceId=2&cm...
As for why it would be on your old PlayBook, I've noticed that early releases included all the apps - and then that was changed. The only two ways to get around this is to either sideload the video chat app or use a proxy in another country to set up your new PlayBook.
1. If any post helps you please click the below the post(s) that helped you.
2. Please resolve your thread by marking the post "Solution?" which solved it for you!
Maybe you are looking for
-
Dreamweaver MX 2004 error with tables in Windows 7
I did a full install of MX 2004 on my Windows 7 PC however everytime I go to add a new table, MX gives me an error message and it won't allow me to add the new table or do anything for that matter. I had to re-install DW 4 to design my sites in the
-
Problem with forward using RequestDispatcher
Dear All Below is my code, which trying to use the RequestDispatcher.forward to go from a Servlet to a .jsp page. and use getServletContext().setAttribute("SvBio",vBio); to set an attribute It compiles finely but stuck at the forward request to the j
-
Oracle 11 upgrade in suse 10sp2
Hi Friends, I have IBM x3650 M3 Server in which i have OS Suse linux 10sp2 Database oracle 10g (10.2.0.4.0) Application SAP BI 7.0 I have requirement of upgrading the database to 11g. I have tried to do the upgrade in 10sp2 and face lot of kernel par
-
Export ALV with the current layout to excel via selection screen
Hello, I want to export my ALV table with my default layout, but from the selection screen. In other words i want the function "List ->export -> spreadsheet" to be done via the selection screen when the user push the "run" button. Is that possible ?
-
Connection with SQL server 2000
Hello.I could sure use help here :) I have JBuilder 9 and jdk1.4(OS Windows XP).I have downloaded from Microsoft the driver for Sql server and installed it.I fixed the classpath too.But when I try to connect I cant get it work. I have the next source