Develop a Messenger

Hi
I want to develop, a messenger similar to the one being used in facebook or google for college project. Can you give me some pointers on how to develop?
Also, I would like it to be developed with J2EE and I don't want to use java swings
Edited by: user7041221 on Jan 9, 2012 2:45 AM

Nicky wrote:
What things do you have in your hands now? How much experience do you have?Very good questions.
Why not look at an open source software to learn from it?Because you don't gain understanding from looking at code, you only learn to apply the code without understanding it. That may work for a short time, but ultimately the pile of code you do not understand will come back to bite you when it flips you the finger.
OP: your question relates to both the backend ("JEE") and the front end, which is more Ajax/Javascript territory. If you learn how Ajax works you probably already have all the understanding you need to solve the entire requirement, or at least you'll figure out what you need to research more. A study of Ajax in general and Investigating javascript toolkits such as JQuery will probably be a good start.

Similar Messages

  • Help in Developing Java Messenger

    Hello everyone
    I would like to know (In full details) what are the requirements to build a Java Messenger consedering that it will be an interanet messenger for my LAN network.
    I have to do a graduation project and i think to
    build a Messenger Application using java.
    I will appreciate if someone can help me.
    thanks in advance.

    Hello everyone
    I would like to know (In full details) what are the
    requirements to build a Java Messenger consedering
    that it will be an interanet messenger for my LAN
    network.
    I have to do a graduation project and i think to
    build a Messenger Application using java.
    I will appreciate if someone can help me.
    thanks in advance.Will I get your degree if I tel you?

  • Possible ways to develope messenger service like MSN etc

    hi everyone,
    I am developing a Messenger service for client. I used swings and back end servlets. Now if user X wants to send Message to User Y in his friendList then how do I send it?
    I did like running thread form both frames friend and member and collectiong messages from their inbox. For this one, thread which is running on instantFrame makes call to servlet every 20 secs. this really affects the performance of application. So can any one tell me what will next approach to messenger ?
    Any reply will appreciate.
    regards
    dgk

    I don't quite understand...but why don't you use sockets?

  • Messenger problem

    i have developed a messenger program, and have enabled a client to also act as the server in a multiple person conversation. Now, the server can see all message sent from other clients but those messages of which the server it self creates and sends and clients can not see. This also happens for other clients, they can not see what other clients have typed. I have tried creating a thread that each client has which constantly requests data from the server, but this does not work. i will post some of my code here. There is a lot of code, so if need be ill paste the entire amount. Thanks for any help possible. (By the way, this program consists of 3 classes, the following being the networking classes, the main class holds the constructor etc.)
    class SocketClient extends JFrame implements Runnable {
         Socket socket = null;
       PrintWriter out = null;
       BufferedReader in = null;
              String text = null;
         Thread getdata;
       SocketClient(){
         public void listenSocket() {
         if ( connected==("2") ) {
    //Create socket connection
         try{
           socket = new Socket("0.0.0.0", 4444);
           out = new PrintWriter(socket.getOutputStream(), true);
           in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
         } catch (UnknownHostException e) {
           System.out.println("Unknown host: host your connecting to");
           System.exit(1);
         } catch  (IOException e) {
           System.out.println("No I/O");
           System.exit(1);
                   connected = "1";
                   out2 = out;
                   in2 = in;
         if (thisclient==("1"))
              creategetdatathread();
         if (thisclient==("2"))
         { Thread senddataThread = new Thread(this);
              senddataThread.equals(Thread.currentThread());
              System.out.println("current thread is after thisclient = 2 " + Thread.currentThread() + senddataThread);
              senddataThread.start();
              thisclient = "3";
         senddata();
    public void creategetdatathread()
    System.out.println("In creategetdatathread");
         Thread getdata = new Thread(this);
              getdata.equals(Thread.currentThread());
              System.out.println("current thread is after thisclient = 1 " + Thread.currentThread() + senddataThread);
              thisclient = "4";
              getdata.start();
    public void run()
              if(getdata != null && getdata.equals(Thread.currentThread()) )
                   System.out.println("running getdata thread");
                   getdatamethod();
              if(senddataThread != null && senddataThread.equals(Thread.currentThread()) )
                   System.out.println("running senddataThread thread");
                   senddatamethod();
    public void senddatamethod() {
    while(true) {
           try{
           String line = in2.readLine();
              if (line != null) {
              out2.println(line);
              else {
              break;}
           } catch (IOException e){
          System.out.println("Read failed");
                 System.exit(1);
              try { Thread.sleep(2000); }
                   catch(InterruptedException e) {}
    public void getdatamethod() {
    while(true) {
           try{
           String line = in2.readLine();
              if (line != null)
              messlistArea.append("Message:" + line + "\n");
              else {
              break;               // break otherwise the method will never return
           } catch (IOException e){
          System.out.println("Read failed");
                 System.exit(1);
              try { Thread.sleep(2000); }
                   catch(InterruptedException e) {}
    public void senddata() {
         //Send data over socket
         System.out.println("in send data method");
              String text = messageArea.getText();
              out2.println(text);
           messageArea.setText(new String(""));
    //Receive text from server
           try{
           String line = in2.readLine();
              if (thisclient==("4"))
              messlistArea.append("Message:" + line + "\n");
           } catch (IOException e){
          System.out.println("Read failed");
                 System.exit(1);
         class ClientWorker implements Runnable {
      Socket client;
         ServerSocket server = null;
         ClientWorker(Socket client) {
       this.client = client;
    public void whiletruemethod() {
    while(true){
          ClientWorker w;
          try{
            w = new ClientWorker(server.accept());
            t = new Thread(w);
            t.start();
          } catch (IOException e) {
            System.out.println("Accept failed: 4444");
            System.exit(-1);
    public void threadtmethod() {
    BufferedReader in = null;
    PrintWriter out = null;
        try{
          in = new BufferedReader(new InputStreamReader(client.getInputStream()));
          out = new PrintWriter(client.getOutputStream(), true);
        } catch (IOException e) {
          System.out.println("in or out failed");
          System.exit(-1);
              dontgo = "2";
              String line;
        while(true){
              System.out.println("RUN");
                try{
            line = in.readLine();
                        if(line != null) {
                        //Send data back to client
             out.println(line);
                             messlistArea.append("Message Recieved: " + line + "\n");
                        else {break;}
           } catch (IOException e) {
             System.out.println("Read failed");
             System.exit(-1);
                                       try { Thread.sleep(2000); }
                   catch(InterruptedException e) {}
      public void run(){
         if (t == Thread.currentThread() )
                   System.out.println("Running t Thread");
                   threadtmethod();
      if (whiletrue == Thread.currentThread() )
                   System.out.println("Running Thread");
                   whiletruemethod();
      public void listenSocket(){
         thisserver = "1";
        try{
          server = new ServerSocket(4444);
        } catch (IOException e) {
          System.out.println("Could not listen on port 4444");
          System.exit(-1);
         whiletrue = new Thread(this);
         whiletrue.start();
      protected void finalize(){
    //Objects created in run method are finalized when
    //program terminates and thread exits
         try{
            server.close();
        } catch (IOException e) {
            System.out.println("Could not close socket");
            System.exit(-1);
              public static void main(String[] args) {
                                       kmess app = new kmess();
    }

    ok well here is the entire code:
    // by brett kennelly
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    public class kmess implements ActionListener {
    JLabel logo, friendtypingLabel;
    JButton sendButton, addipButton, listButton, disconButton, hostButton, enteripButton;
    JPanel mesbodyPanel, butbodyPanel, alertPanel, messinPanel, friendsPanel, titlePanel, addipPanel;
    JFrame frame, friendFrame, addipFrame;
    static JTextField messageField, ipField;
    JTextArea friendName, friendIP;
    static JTextArea messlistArea, messageArea;
    JMenuBar menubar;
    JMenu filemenu, aboutmenu;
    JMenuItem closeMenu, ipMenu;
    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints pos = new GridBagConstraints();
    static String ipaddress = null;
    static String ipofclient = null;
    // client initialisation
    String created = "1";
    Socket socket, client, socketvar = null;
    PrintWriter out, out1 = null;
    BufferedReader in, in1 = null;
    static PrintWriter out2 = null;
    static BufferedReader in2 = null;
    String dontgo, go = "1";
    String serveropen = "3";
    String connected = "2";
    static String thisserver = "1";
    static String thisclient = "1";
    // server intialisation
    ServerSocket server = null;
    Boolean     open = null;
    String line;
    boolean closed = false;
    static Thread runner, senddata, t, whiletrue;
    static Thread getdata = null;
    static Thread senddataThread = null;
    Image connectImage = Toolkit.getDefaultToolkit().getImage("connect.gif");
         ImageIcon conIcon = new ImageIcon(connectImage);
    Image listImage = Toolkit.getDefaultToolkit().getImage("Open Contact List.gif");
         ImageIcon listIcon = new ImageIcon(listImage);
    Image addipImage = Toolkit.getDefaultToolkit().getImage("add ip.gif");
         ImageIcon addipIcon = new ImageIcon(addipImage);
    Image detailsImage = Toolkit.getDefaultToolkit().getImage("details.gif");
         ImageIcon detailsIcon = new ImageIcon(detailsImage);
    Image sendImage = Toolkit.getDefaultToolkit().getImage("send.gif");
         ImageIcon sendIcon = new ImageIcon(sendImage);
    Image disconImage = Toolkit.getDefaultToolkit().getImage("Disconnect.gif");
         ImageIcon disconIcon = new ImageIcon(disconImage);
    Image hostImage = Toolkit.getDefaultToolkit().getImage("HostServe.gif");
         ImageIcon hostIcon = new ImageIcon(hostImage);
         // title logo created images created
         Image titleoutImage = Toolkit.getDefaultToolkit().getImage("titlelogoout.gif");
              ImageIcon titleoutIcon = new ImageIcon(titleoutImage);
         Image titleinImage = Toolkit.getDefaultToolkit().getImage("titlelogoin.gif");
              ImageIcon titleinIcon = new ImageIcon(titleinImage);
                        public kmess() {
                                       // create ip address input objects
                                       ipField = new JTextField(15);
                                       enteripButton = new JButton("Enter IP");
                                       enteripButton.addActionListener(this);
                                       enteripButton.setActionCommand("enterip");
                                       // create ip address input panel and frame
                                       addipPanel = new JPanel();
                                       addipPanel.add(ipField);
                                       addipPanel.add(enteripButton);
                                       addipFrame = new JFrame();
                                       addipFrame.getContentPane().add(addipPanel);
                                       addipFrame.setSize(200,100);
                                       addipFrame.setVisible(false);
                        // create the menu bar
                        menubar =  new JMenuBar();
                        // build the first menu for the menu bar
                        filemenu = new JMenu("File");
                        filemenu.setMnemonic(KeyEvent.VK_F);
                        menubar.add(filemenu);
                        ipMenu = new JMenuItem("Add Ip", KeyEvent.VK_I);
                        ipMenu.setAccelerator(KeyStroke.getKeyStroke(
                                    KeyEvent.VK_I, ActionEvent.CTRL_MASK));
                        ipMenu.addActionListener(this);
                        ipMenu.setActionCommand("addip");
                        filemenu.add(ipMenu);
                        closeMenu = new JMenuItem("Close", KeyEvent.VK_C);
                        closeMenu.setAccelerator(KeyStroke.getKeyStroke(
                                       KeyEvent.VK_C, ActionEvent.CTRL_MASK));
                        closeMenu.addActionListener(this);
                        closeMenu.setActionCommand("close");
                        filemenu.add(closeMenu);
              // Buttons in main frame created
                   sendButton = new JButton(sendIcon);
                   sendButton.setSize(300,200);
                   //     sendButton.setRolloverIcon();
                   sendButton.addActionListener(this);
                   sendButton.setActionCommand("sendmessage");
                   sendButton.setToolTipText("Click here to send the message!");
                   addipButton = new JButton(addipIcon);
                   addipButton.setSize(50,75);
                   //     addipButton.setRolloverIcon();
                   addipButton.addActionListener(this);
                   addipButton.setActionCommand("addip");
                   addipButton.setToolTipText("Click here to Add the ip of a friend and connect");
                   hostButton = new JButton(hostIcon);
                   hostButton.setSize(50,200);
                   hostButton.addActionListener(this);
                   hostButton.setActionCommand("host");
                   hostButton.setToolTipText("Click here to host a conversation");
                   disconButton = new JButton(disconIcon);
                   disconButton.setSize(50,75);
                   //     disconButton.setRolloverIcon();
                   disconButton.addActionListener(this);
                   disconButton.setActionCommand("disconnect");
                   disconButton.setToolTipText("Click here to disconnect from friend");
                   // title button is created
                   JButton contButton = new JButton(titleoutIcon);
                   contButton.setRolloverIcon(titleinIcon);
                   contButton.addActionListener(this);
                   contButton.setActionCommand("continue");
                   // label displaying whether friend is typing is created
                   friendtypingLabel = new JLabel(" ", SwingConstants.CENTER);
              // create messenger input text field
              messageArea = new JTextArea(4, 30);
              messageArea.setLineWrap(true);
              messageArea.setToolTipText("Type Your Message Here and Click SEND to send the message");
              // create the text area in messenger
              messlistArea = new JTextArea(20, 54);
              messlistArea.setEditable(false);
              messlistArea.setLineWrap(true);
              messlistArea.setToolTipText("Message History will be displayed here");
              // creates new scroller used for the message history text area
              JScrollPane meslistscroll = new JScrollPane(messlistArea,
              JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
              JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
              // creates new scroller for message input textfield
              JScrollPane mesinputscroll = new JScrollPane(messageArea,
              JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
              JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
              // top panel that hosts all the buttons is created
              butbodyPanel = new JPanel();
              butbodyPanel.add(hostButton);
              butbodyPanel.add(addipButton);
              butbodyPanel.add(disconButton);
              butbodyPanel.setVisible(false);
              // creates panel for msg input and send button
              JPanel msgPanel = new JPanel();
              msgPanel.setLayout(layout);
                   pos.gridx = 1;
                   pos.gridy = 0;
              msgPanel.add(sendButton, pos);
                   pos.gridx = 0;
                   pos.gridy = 0;
                   pos.fill = GridBagConstraints.BOTH;
                   pos.weightx = 0.7;
                   pos.weighty = 1.0;
              msgPanel.add(mesinputscroll, pos);
              msgPanel.setVisible(true);
                        // create the top-level container
                        frame = new JFrame("[K�] Messenger");
                        frame.setSize(700,500);
                        frame.getContentPane().setLayout(layout);
                        frame.setJMenuBar(menubar);
                        menubar.setVisible(false);
                        pos.fill = GridBagConstraints.BOTH;
                        pos.weightx = 0.0;
                        pos.weighty = 0.0;
                                  // panel that houses message area is created and message area is added
                                  mesbodyPanel = new JPanel();
                                  mesbodyPanel.setLayout(layout);
                                       pos.gridx = 0;
                                       pos.gridy = 0;
                                       pos.weightx = 1.0;
                                       pos.weighty = 0.7;
                                  mesbodyPanel.add(meslistscroll, pos);
                                       pos.gridx = 0;
                                       pos.gridy = 1;
                                       pos.weightx = 1.0;
                                       pos.weighty = 0.0;
                                  mesbodyPanel.add(friendtypingLabel, pos);
                                       pos.gridy = 2;
                                       pos.weightx = 1.0;
                                       pos.weighty = 0.2;                                   
                                  mesbodyPanel.add(msgPanel, pos);
                                  mesbodyPanel.setVisible(false);
                                  // panel that has main title is created and added
                                  titlePanel = new JPanel();
                                  titlePanel.add(contButton);
                                  titlePanel.setVisible(true);
                                  pos.gridy = 0;
                                  pos.weightx = 1.0;
                                  pos.weighty = 0.0;
                        frame.getContentPane().add(butbodyPanel, pos);
                                  pos.gridy = 1;
                                  pos.weightx = 1.0;
                                  pos.weighty = 1.0;
                        frame.getContentPane().add(mesbodyPanel, pos);
                        frame.getContentPane().add(titlePanel);
                        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                        frame.setVisible(true);
                        public void actionPerformed(java.awt.event.ActionEvent e) {
              String command = e.getActionCommand();
         // start of program, from title screen
         if (command.equals("continue")) {
              titlePanel.setVisible(false);
              mesbodyPanel.setVisible(true);
              butbodyPanel.setVisible(true);
              menubar.setVisible(true);
              // menu action listener commands
              if (command.equals("close")) {
                   System.exit(1);
                        // messenger action listener commands
                        if (command.equals("sendmessage")) {
                             friendtypingLabel.setText("Message Sent");
                             System.out.println(thisclient);
                             SocketClient c = new SocketClient();
                             c.listenSocket();     
                        if (command.equals("addip")) {
                             addipFrame.setVisible(true);
                        if (command==("disconnect")) {
                             try{
                      socketvar.close();
                                 } catch (IOException f) {
                      System.out.println("Could not close socket");
                                  messlistArea.append("Disconnected");
                        if (command==("host")) {
                             friendtypingLabel.setText("Hosting Conversation");
                             ClientWorker cw = new ClientWorker(null);
                             thisclient = "2";
                             cw.listenSocket();
                        if (command==("enterip")) {
                             String line = ipField.getText();
                                  ipaddress = line;
                             addipFrame.setVisible(false);
    class SocketClient extends JFrame implements Runnable {
         Socket socket = null;
       PrintWriter out = null;
       BufferedReader in = null;
              String text = null;
         Thread getdata;
       SocketClient(){
         public void listenSocket() {
         if ( connected==("2") ) {
    //Create socket connection
         try{
           socket = new Socket("0.0.0.0", 4444);
                   socketvar = socket;
           out = new PrintWriter(socket.getOutputStream(), true);
           in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
         } catch (UnknownHostException e) {
           System.out.println("Unknown host: host your connecting to");
           System.exit(1);
         } catch  (IOException e) {
           System.out.println("No I/O");
           System.exit(1);
                   connected = "1";
                   out2 = out;
                   in2 = in;
         if (thisclient==("1"))
              creategetdatathread();
         if (thisclient==("2"))
         { Thread senddataThread = new Thread(this);
              senddataThread.equals(Thread.currentThread());
              System.out.println("current thread is after thisclient = 2 " + Thread.currentThread() + senddataThread);
              senddataThread.start();
              thisclient = "3";
         senddata();
    public void creategetdatathread()
    System.out.println("In creategetdatathread");
         Thread getdata = new Thread(this);
              getdata.equals(Thread.currentThread());
              System.out.println("current thread is after thisclient = 1 " + Thread.currentThread() + senddataThread);
              thisclient = "4";
              getdata.start();
    public void run()
              if(getdata != null && getdata.equals(Thread.currentThread()) )
                   System.out.println("running getdata thread");
                   getdatamethod();
              if(senddataThread != null && senddataThread.equals(Thread.currentThread()) )
                   System.out.println("running senddataThread thread");
                   senddatamethod();
    public void senddatamethod() {
    while(true) {
           try{
           String line = in2.readLine();
              if (line != null) {
              out2.println(line);
              else {
              break;}
           } catch (IOException e){
          System.out.println("Read failed");
                 System.exit(1);
              try { Thread.sleep(2000); }
                   catch(InterruptedException e) {}
    public void getdatamethod() {
    while(true) {
           try{
           String line = in2.readLine();
              if (line != null)
                             ipofclient = InetAddress.getLocalHost().getHostAddress();
              messlistArea.append(ipofclient + " says " + line + "\n");
              else {
              break;               // break otherwise the method will never return
           } catch (IOException e){
          System.out.println("Read failed");
                 System.exit(1);
              try { Thread.sleep(2000); }
                   catch(InterruptedException e) {}
    public void senddata() {
         //Send data over socket
         System.out.println("in send data method");
              String text = messageArea.getText();
              out2.println(text);
           messageArea.setText(new String(""));
    //Receive text from server
           try{
           String line = in2.readLine();
              if (thisclient==("4"))
              messlistArea.append("I Said: " + line + "\n");
           } catch (IOException e){
          System.out.println("Read failed");
                 System.exit(1);
         class ClientWorker implements Runnable {
      Socket client;
         ServerSocket server = null;
         ClientWorker(Socket client) {
       this.client = client;
    public void whiletruemethod() {
    while(true){
          ClientWorker w;
          try{
            w = new ClientWorker(server.accept());                    
            t = new Thread(w);
            t.start();
          } catch (IOException e) {
            System.out.println("Accept failed: 4444");
            System.exit(-1);
    public void threadtmethod() {
    BufferedReader in = null;
    PrintWriter out = null;
        try{
          in = new BufferedReader(new InputStreamReader(client.getInputStream()));
          out = new PrintWriter(client.getOutputStream(), true);
        } catch (IOException e) {
          System.out.println("in or out failed");
          System.exit(-1);
              dontgo = "2";
              String line;
        while(true){
              System.out.println("RUN");
                try{
            line = in.readLine();
                        if(line != null) {
                        //Send data back to client
                             if (thisclient != "3") {
             out.println(line);
                             ipofclient = InetAddress.getLocalHost().getHostAddress();
                             messlistArea.append(ipofclient + " says " + line + "\n");
                             else {
                                  out.println(line);
                                  messlistArea.append("I said: " + line + "\n");
                        else {break;}
           } catch (IOException e) {
             System.out.println("Read failed");
             System.exit(-1);
                                       try { Thread.sleep(2000); }
                   catch(InterruptedException e) {}
      public void run(){
         if (t == Thread.currentThread() )
                   System.out.println("Running t Thread");
                   threadtmethod();
      if (whiletrue == Thread.currentThread() )
                   System.out.println("Running Thread");
                   whiletruemethod();
      public void listenSocket(){
         thisserver = "1";
        try{
          server = new ServerSocket(4444);
        } catch (IOException e) {
          System.out.println("Could not listen on port 4444");
          System.exit(-1);
         whiletrue = new Thread(this);
         whiletrue.start();
      protected void finalize(){
    //Objects created in run method are finalized when
    //program terminates and thread exits
         try{
            server.close();
        } catch (IOException e) {
            System.out.println("Could not close socket");
            System.exit(-1);
              public static void main(String[] args) {
                                       kmess app = new kmess();
    }

  • How Jabber messenger in Java supports voice???

    I am developing the messenger application based on Jabber protocol in J2SE that provides the basic functionality of messenger plus whiteboad,audio\vedio chatting and conferencing , file transfering and desktop sharing.We are actually three persons working on this project with one project leader.We are using Wildfire as Jabber server and mounted this server on Tomcat Apache.We have completed the chat,group chat and whiteboard.Now we look for the right alternate for voice chat .If you have ever heard about the LibJingle library which is basically provided by GoogleTalk.So.if you know about it then reply me soon.Or any other alternative that the Jabber messenger supported.
    Hoping for your answer....
    Sach Farmer

    Take a look to this :
    http://www.jivesoftware.org/index.jsp

  • Voice chat in Jabber messenger

    Hi,everyone
    I am developing the messenger application based on Jabber protocol in J2SE that provides the basic functionality of messenger plus whiteboad,audio\vedio chatting and conferencing , file transfering and desktop sharing.We are actually three persons working on this project along with one project leader.We are using Wildfire as Jabber server and mounted this server on Tomcat Apache.We have completed the chat,group chat and whiteboard.Now we are lookin for the right alternate for voice chat .So please tell me what should i suppose to do now I mean how java implements SIP,VOIP,SID like protocol OR Libjingle library provided by Google.
    Please help me.
    Sach Farmer

    Java doesn't implement any of these. Some libraries written in Java do. Though J2SE has no standard library for either of those, I think. There might be 3rd party libs you can use - you already know Google, so I don't need to hint you at it.

  • Server side programming fails!

    hello. i'm developing a messenger program. initial design had one client sending a message and the server echoing the message back to the client. it worked fine. now i'm making it for multiple clients. that is one client sending a message and multiple clients receiving the message like in chat rooms. the following is my code which runs without compile time or run time errors yet does not do its job of echoing the message.
    package server;
    import java.io.*;
    import java.net.*;
    import java.lang.*;
    class Server
        ServerSocket ss = null;
        Socket soc = null;
        BufferedReader in = null;
        PrintWriter out = null;
        static Server obj = null;
        public static void main(String[] args) throws Exception
            obj = new Server();
            obj.listen();
        public void listen() throws Exception
            ServerSocket ss = new ServerSocket(9090);
            while(true)
                Socket soc = ss.accept();
                Connection c = new Connection();
                Thread t = new Thread(c);
                t.start();
    package server;
    import java.net.*;
    import java.io.*;
    import java.lang.*;
    class Connection extends Thread
        public void run()
            String str = "";
            try
                Server.obj.in = new BufferedReader(new InputStreamReader(Server.obj.soc.getInputStream()));
                Server.obj.out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(Server.obj.soc.getOutputStream())),true);
                str = Server.obj.in.readLine();
                while(str!=null)
                    Server.obj.out.println(str);
                    str = Server.obj.in.readLine();
                Server.obj.soc.close();
            catch(Exception e)
    }

    the client program is as follows....
    * Client.java
    * Created on February 20, 2007, 12:56 PM
    package client;
    import java.io.*;
    import java.net.*;
    import java.lang.*;
    * @author  Neerav
    public class Client extends javax.swing.JFrame {
        static String str = "";
        static InetAddress ip = null;
        static Socket soc = null;
        static PrintWriter out = null;
        static BufferedReader in = null;
        static Receive rc = null;
        static Send sd = null;
        /** Creates new form Client */
        public Client() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
        private void initComponents() {
            jLabel1 = new javax.swing.JLabel();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextArea1 = new javax.swing.JTextArea();
            jScrollPane2 = new javax.swing.JScrollPane();
            jTextArea2 = new javax.swing.JTextArea();
            jLabel2 = new javax.swing.JLabel();
            jButton1 = new javax.swing.JButton();
            jButton2 = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jLabel1.setText("Message History");
            jTextArea1.setColumns(20);
            jTextArea1.setEditable(false);
            jTextArea1.setRows(5);
            jScrollPane1.setViewportView(jTextArea1);
            jTextArea2.setColumns(20);
            jTextArea2.setRows(5);
            jScrollPane2.setViewportView(jTextArea2);
            jLabel2.setText("Your Message");
            jButton1.setText("Send");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            jButton2.setText("Clear");
            jButton2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton2ActionPerformed(evt);
            org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                        .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)
                        .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)
                        .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel2)
                        .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                            .add(jButton1)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 284, Short.MAX_VALUE)
                            .add(jButton2))
                        .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel1))
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .add(jLabel1)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 165, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jLabel2)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 47, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jButton1)
                        .add(jButton2))
                    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            pack();
        }// </editor-fold>                       
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            sd.send();
        private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            str ="";
            jTextArea2.setText(str);
         * @param args the command line arguments
        public static void main(String args[])
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Client().setVisible(true);
            try
                ip = InetAddress.getByName("127.0.0.1");
                soc = new Socket(ip,9090);
                out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(soc.getOutputStream())),true);
                in = new BufferedReader(new InputStreamReader(soc.getInputStream()));
            catch(Exception e)
            sd = new Send();
            rc= new Receive();
            Thread receive = new Thread(rc);
            receive.start();
        // Variables declaration - do not modify                    
        private javax.swing.JButton jButton1;
        private javax.swing.JButton jButton2;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JScrollPane jScrollPane2;
        public static javax.swing.JTextArea jTextArea1;
        public static javax.swing.JTextArea jTextArea2;
        // End of variables declaration                  
    ackage client;
    import java.io.*;
    import java.net.*;
    class Send
        public void send()
           Client.str = Client.jTextArea2.getText();
           Client.out.println(Client.str);
           Client.str="";
           Client.jTextArea2.setText(Client.str);
    package client;
    import java.io.*;
    import java.net.*;
    import java.lang.*;
    class Receive extends Thread
        public void run()
            while(true)
                try
                    Client.str = Client.in.readLine();
                    while(Client.str!=null)
                        Client.jTextArea1.append(Client.str);
                        Client.jTextArea1.append("\n");
                        Client.str = Client.in.readLine();
                catch(Exception e)
    }

  • Uml  and client server programming

    I m developing chat messenger. i am finding difficult to apply uml on this type of software (client server).can any one give me sample documentation or tutorials

    UML can express and communicate your
    ideas for sure, but it's not where to start with the
    high level architecture unless you have an idea about
    how to achieve it.
    Once you have an idea of how it should work, then the
    activity diagrams/sequence diagrams/collaboration
    diagrams will just drop out of you and into the model.Actually, UML usually is the first place to start. Specifically, the Use Case diagram is often the starting point in designing a system. The first iteration of these diagrams will be very rough for sure, but what better way to begin discovering the functionality of a system than to (at a very high level) determine who's gonna use the system and how they are going to use the system.
    A common practice is to get a sheet of paper and draw a line down the middle (making two column). Label them actors (left colum) and processes (right column). Starting with the right column, list (again, at a very hight level) the thins that your system should do. Repeat this for the left column, this time thinking of the "types" of users that will use the processes you've just listed. Then you draw lines from the actors to the processes and this is the begining of your use cases. The next steps is to start storyboarding the use cases. This forces you to think of what each process does in in a little more detail. From there, you will begin to see common behavior and even new use cases. It takes a few iterations to fully discover and realize use cases, but you start with the 10,000' view of it this way.
    For example (and this is just an example):
    actors               processes
    System               Post a message
    Authenticated User   Read a message
    Anonymous User       Delete a message thread
    Administrator        Login
                         Logout
                         Register
                         Update Profile
                         Generate Audit EntryWhen you draw the lines from actors to processes in the above example, you'll note some the following:
    1. System can Generate Audit Entry
    2. Authenticated User can Post a message, Read a message, Logout and Update Profile
    3. Anonymous User can Reade a message, Login and Register
    4. Administrator can Post a message, Read a message, Delete a message thread, Logout and Update Profile
    Again, this is just an example. You should see that it give you a bird's eye view of the services to be provided by your system and who can use those services. When you begin realizing your use cases (the processes in the above example), you will begin to see behavior that is common to many services. These behaviors are what will begin helping you to eventually make architecture level decisions.

  • Message logs

    Hi
    I m developing a messenger.
    Can anyone help me in deciding the format I should use to save my message logs, ie. txt files or databases, How does MSN and Yahoo save message logs at server end?

    DON'T CROSSPOST:
    http://forum.java.sun.com/thread.jsp?thread=478913&forum=31&message=2227299

  • What is personalJava

    Hi there,
    I've just started working with j2me, i've ordered a book on amazon "core J2ME" -but its gonna take a week. I've been trying to make an early start on learning it. I have set myself the task of developing a messenger on a p800 -sony ericsson.
    When reading up on the api/specifications provided by sony "personalJava" is mentioned. From what i understand it seemed like an advanced version of program- perhaps with more components allowing for a more detailed gui?
    I've tried looking for examples/tutorials relating to J2ME and personalJava but i've had no luck. Can anyone shed any light on either? Even if you could tell me if there is a relationship between the two.
    Thanks in advance,
    Chris

    Personal Java is the former small platform runtime and a predecessor to J2ME Configurations and Profiles. If you look at http://java.sun.com/products/personaljava/ they are preannouncing end-of-life for that product. An equivalent J2ME set is PersonalProfile (JSR-062 + JSR-046 + JSR-036). Optionally you could add RMI (JSR-066) and when it is finalized and you have a supported database driver, the JDBC optional package (JSR-169).
    That said, there are still many manufacturers selling/providing the Personal Java runtime as they have not migrated or certified their J2ME Runtimes against Personal Profile. If that's what's provided on your platform, use JavaCheck (http://java.sun.com/products/personaljava/javacheck.html) to ensure you're not using any API's available on the phone and write your app. Other than deprecated methods, you should be able to port it to PPro very easily. PPro has both regular socket framework plus the newer microediton.io Connector framework. To be portable, stick with java.net.

  • RTPManager in JXTA

    Hello to all. I have been working these last days making video conference using the RTPManager in JXTA networks. i had maden tests.. and is possible do it in the unicast way by means of the implementation of the RTPConnector... which I do customization of transport by means of JXTASocket.. this works for communications of unicast mode . Well my problem comes at the time that i want to do it in multicast way since metodo addTarget(SessionAddress remoteAddress) does not work in JXTA.. reason for which I have decided to construct a RTPManager from the JMF sources to change java.net.MulticastSocket by net.jxta.socket.JXTAMulticastSocket somebody knows which is the class that implements or extends RTPManager?

    Hi Culosabroso,
    First of all, congrates you on successfully build an unicast peer-to-peer video conference JXTA client.
    I have the same question, why you want to use multicast?
    Is it a video conferencing which involved more than 1 peer in a Group? So it's a group to group multicast?
    Please update your progress, I'm interested in your work. I'm exciting to bring you in my team in developing "Instant Messenger for Java User Group" (JUGIM), we need some kind of video conferencing too ... that will be cool.
    By Avatar
    leader of KLJUG
    project owner of JUGIM (http://jugim.dev.java.net)

  • Messanger: User log-in notification.

    Hi guys.
    I am trying to find the best solution for the following requirement:
    In the Messanger application, every user has a tree of added friends to chat with. When user loged in, and the tree of friends has been loaded,  every frend name which is online, in the tree (tree node) colored with the green color.
    Later on, one more user from the tree loged in. The color of newly logged in user should be changed to green.
    What is the best way to notify the three to change a color of newly loged in user?
    I realy don't want to monitor the database every 5 or 10 or etc. seconds sending ajax or http requests. Does FLEX have some tools to do that?
    Thanks.

    Hi,
    If you're developping a messenger application, I think you already have a kind of server to client communication...
    How your client is receiving messages from others? You could use the same to transmit "service" data telling who is online or not...
    One of our application is a kind of a collaborative tool (exchange drawings and chat messages), we developped it based on the blazeDS/AMF Consumer architecture. We've build above our protocol, which transmit "service" (who's online, what is the current space share, and so on...) along with the "client" data (the messages, the files, and so on). The protocol ensure also that a message was well transmited (ACK mechanism).
    Hope it helps,
    Mich

  • Help needed to develop MESSENGER

    Hi,
    I would like to develope an Instant Messenger with Flash 8.
    I have linux installed on my SERVER with php, mysql and
    amfphp and all are working fine.
    I have also designed the database required, but I do have a
    problem. Can anybody tell me the concept of messenger chating
    window....?? I mean to say how it is possible to send messages to
    the end user who is online in my list....?? What should I do to
    detect the window opened at his end and populate that msg. window
    with my message...??
    If anybody can help me out to understand the concept. Whether
    I should use the client's login session ID or the opened window to
    send the message or what...??
    Help for this topic will be highly appreciated.
    Thanks and regards,
    Shrijal.

    There are 2 ways to do a chat: have the server transmit the
    messages to the users or let the client ask the server for new
    messages. I'd recommend the first one, it's faster and also easier.
    For that, you'll need a socket connection clientside
    (XMLSocket) and a server process serverside. Now this is where the
    trouble begins, most web hosters don't allow you to start services
    on their servers. But as you mentioned you have your own server,
    this shouldn't be a problem. Pick a language of your choice or
    maybe use php to write the server, and let it manage the open
    connections, so when a new messages arrives, it can broadcast it to
    all other connections.
    If you won't or can't do it this way, your clients have to
    pull for the messages, meaning they have to ask the server in some
    interval for new messages, and load them if available. You can't
    actively send the messages to some user, they all have to get them
    by themselves. There's a tutorial on that way here:
    http://www.sephiroth.it/tutorials/flashPHP/flash_chat/.
    cheers,
    blemmo

  • Is someone developing a windows live messenger video chat app for the ipad2...if so, any idea when it is due to come out?

    Is anyone developing an app to allow windows live messenger video chat on the iPad2?  They have one for iPhone already?  If so, when will it come out?

    They are available now!

  • SAP MM Functional Developer ~ Dublin OH

    Start Date: IMMEDIATELY!
    Positions Available: 1
    Employee Type: Contractor - 1099
    Hrs/Wk.:  40 Hrs.
    Duration: 9 Months
    Pay Rate:  $80 - $88/Hr. DOE
    Work Status: Green Card or US Citizen Highly Desirable
    H1B Sponsorship is not available at this time.
    Corp to Corp is available for Green Card Holders.
    GENERAL RESPONSIBILITIES:
    The Functional Developer in the Materials Management and Production Planning modules is responsible for understanding requirements, creating designs, developing, testing, implementing, and documenting environment configuration and processes in the Purchasing and Inventory areas. The Functional Developer is also responsible for coordinating configuration transport objects, in their specific functional area, and managing the change control process from the development through the production instance.
    SPECIFIC DUTIES, ACTIVITIES AND RESPONSIBILITIES:
    u2022     Work with the business clients to translate requirements to configurable Solutions
    u2022     Perform analysis of existing MM/PP configuration and processes (including customizations)
    u2022     Develop the most efficient process solutions
    u2022     Find and/or create specific test data
    u2022     Execute all possible test conditions (success and error)
    u2022     Coordinate with Basis team to ensure accurate deployment of transport objects
    u2022     Create/update documentation as appropriate (process flows, architectural diagrams, config docs)
    POSITION REQUIREMENTS:
    Qualifications/Skills Requirements:
    u2022     5 or more years MM configuration experience
    u2022     Experience in multiple SAP versions (4.6C, ECC5, ECC6)
    u2022     Understand SAP Transport Management process
    u2022     Material master configuration and master data maintenance process experience is a huge plus.
    u2022     Integration testing and cutover and deployment experience is a plus.
    u2022     SAP Certification is a plus
    u2022     ABAP Development skills is a plus
    u2022     Ability to multi-task
    u2022     Good coordination and organizational skills
    u2022     Strong command of the English language, both oral and written
    If you feel your knowledge, skills and abilities meet the needs of our clients ~ I want your resume! 
    Send resume, rate of pay requested, availability and work status to me on LinkedIn.
    Please feel free to email or IM me should you have any questions.
    Stephani Ritter
    IT Recruiter
    Follow Me on LinkedIn: http://www.linkedin.com/profile/view?id=90479589&trk=tab_pro
    Pretec Group
    Yahoo Messenger:

    Hi,
    This is the wrong forum for this kind of postings...
    Plz refrain from posting such messages.
    Regards,
    Raj

Maybe you are looking for

  • Need help on Analysing the oracle code.

    Hi, Here i try to frame question, pls understand and give the best way to solve this. We have running 20 to 30 unix scripts on daily basis. Each script has connected to oracle session and execute the corresponding packages & procedures. Some scripts

  • Not able to see model name in Cube Builder

    Hello, I am working on SSM 10.1, I have successfully Created Model connection CBDEFAULT and Created Link id SSM_CB_EA. When I open cube builder link, I am not able to see any Model. When I try to created a new model to in cube builder, it is not able

  • Macbook not working during installation of windows 8.1

    Hello, I am installing Windows 8.1 on my 15" Macbook with Retina Diaplay using the bootcamp. The Windows 8.1 cannot be installed and said that the boot information cannot be changed and the Macbook hanged. After switch off, then on again, even the OS

  • License check failed

    Tried to install twice but received this message. Was online when using it for the first time after both installs. Deinstalled app twice but have only received one refund. So will I be charged for an app that doesn't work and which I no longer have o

  • Bug On Converting AIF files to mp3 on iTunes 8

    Is this a bug? I compose and produce movie scores and iTunes is an easy way to convert AIF masters to mp3 files to mail people . Is just me.... or is there a bug in the latest version what iTunes 8 just re- named - "create mp3 version" causes an UNKN