creating an instant messenger program in java

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Closed Thread

Join Date: May 2005
Posts: 2
Reputation: nausherwan644 is an unknown quantity at this point 
Solved Threads: 0
nausherwan644 nausherwan644 is offline Offline
Light Poster

Re: creating an instant messenger program in java

 
0
  #11
Jun 9th, 2005
is this code is runable like msn or yahoo messenger?? if you have made the messenger like yahoo or msn then please send me its code at my e-mail adress <email snipped> thanks.
Last edited by Ancient Dragon; Feb 1st, 2007 at 9:58 pm. Reason: email snipped
Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: creating an instant messenger program in java

 
0
  #12
Jun 9th, 2005
Quick reply to this message  
Join Date: Mar 2005
Posts: 192
Reputation: stupidenator is an unknown quantity at this point 
Solved Threads: 4
stupidenator's Avatar
stupidenator stupidenator is offline Offline
Junior Poster

Re: creating an instant messenger program in java

 
0
  #13
Jun 9th, 2005
My messenger program just set up its own server and went off that completely independent from aim or yahoo... I never fully got it to work though because I have Cox as my internet provider and they don't allow me to set up a server without upgrading my account to a business account,
Quick reply to this message  
Join Date: Aug 2004
Posts: 350
Reputation: Ghost is an unknown quantity at this point 
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

Re: creating an instant messenger program in java

 
0
  #14
Jun 10th, 2005
stupidenator, PLEASE DO NOT SEND THE CODE!
Quick reply to this message  
Join Date: Mar 2005
Posts: 192
Reputation: stupidenator is an unknown quantity at this point 
Solved Threads: 4
stupidenator's Avatar
stupidenator stupidenator is offline Offline
Junior Poster

Re: creating an instant messenger program in java

 
0
  #15
Jun 10th, 2005
Don't worry... I'm not going to.
Quick reply to this message  
Join Date: Oct 2004
Posts: 274
Reputation: mmiikkee12 is an unknown quantity at this point 
Solved Threads: 5
mmiikkee12's Avatar
mmiikkee12 mmiikkee12 is offline Offline
Posting Whiz in Training

Re: creating an instant messenger program in java

 
0
  #16
Jun 11th, 2005
Quit saying that!

EDIT: I guess he stopped, didn't read the second page.
Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: creating an instant messenger program in java

 
0
  #17
Jun 11th, 2005
Originally Posted by mmiikkee
Quit saying that!

EDIT: I guess he stopped, didn't read the second page.
Nope! He just hasn't posted today.
Quick reply to this message  
Join Date: Jun 2005
Posts: 3
Reputation: amsjavan is an unknown quantity at this point 
Solved Threads: 0
amsjavan amsjavan is offline Offline
Newbie Poster

Re: creating an instant messenger program in java

 
0
  #18
Jun 15th, 2005
I am creating messenger with java and I am creating it with Database and TCP/IP protocol. I have problem in sign in members with Database and with creating JTree in JTree Class.what should i do? please help me.
Quick reply to this message  
Join Date: Jun 2005
Posts: 3
Reputation: amsjavan is an unknown quantity at this point 
Solved Threads: 0
amsjavan amsjavan is offline Offline
Newbie Poster

Re: creating an instant messenger program in java

 
0
  #19
Jun 16th, 2005
It is my Server code and LoginDialog code
It dosent work and dosent sign in . please help me or complete it.

  1. import java.net.*;
  2. import java.io.*;
  3. import java.sql.*;
  4. class Server {
  5. String line;
  6. ServerSocket server=null;
  7. BufferedReader in = null;
  8. PrintWriter out = null;
  9. Socket client = null;
  10. Connection cn;
  11. Statement st;
  12. ResultSet rs;
  13. public static void main(String args[]){
  14. Server st=new Server();
  15. st.listenSocket();
  16. }
  17. public void listenSocket(){
  18. /*************DB Section******************/
  19. try {
  20. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  21. cn = DriverManager.getConnection("jdbc:odbc:MessengerDB");
  22. st = cn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
  23. String Query = "SELECT * FROM Table2";
  24. rs = st.executeQuery(Query);
  25. } catch (ClassNotFoundException e) {
  26. e.printStackTrace();
  27. } catch (SQLException e) {
  28. e.printStackTrace();
  29. }
  30. /*****************************************/
  31. try{
  32. server = new ServerSocket(4444);
  33. } catch (IOException e) {
  34. System.out.println("Could not listen on port 4444");
  35. System.exit(-1);
  36. }
  37. try{
  38. client = server.accept();
  39. } catch (IOException e) {
  40. System.out.println("Accept failed: 4444");
  41. System.exit(-1);
  42. }
  43. try{
  44. in = new BufferedReader(new InputStreamReader(client.getInputStream()));
  45. out = new PrintWriter(client.getOutputStream(), true);
  46. } catch (IOException e) {
  47. System.out.println("Accept failed: 4444");
  48. System.exit(-1);
  49. }
  50. try {
  51. line = in.readLine();
  52. if(line.equals("ok")) {
  53. try {
  54. out.println(rs.getString(1));
  55. out.println(rs.getString(2));
  56. } catch (SQLException e1) {
  57. e1.printStackTrace();
  58. }
  59. }
  60. } catch (IOException e) {
  61. e.printStackTrace();
  62. }
  63. }
  64. }
Quick reply to this message  
Join Date: Jun 2005
Posts: 3
Reputation: amsjavan is an unknown quantity at this point 
Solved Threads: 0
amsjavan amsjavan is offline Offline
Newbie Poster

Re: creating an instant messenger program in java

 
0
  #20
Jun 16th, 2005
It is Login Dialog

  1. //LoginDialog Class
  2. import java.awt.*;
  3. import javax.swing.*;
  4. import java.awt.event.*;
  5. import java.io.*;
  6. import java.net.*;
  7. class LoginDialog extends JDialog implements ActionListener,Constants{
  8. String Username=null,Password=null,Server=null;
  9. JLabel label1,label2,label3,label4;
  10. JTextField user,server,port;
  11. JPasswordField password;
  12. JButton ok,cancel;
  13. Socket client = null;
  14. ServerSocket ss=null;
  15. PrintWriter out = null;
  16. BufferedReader in = null;
  17. String line;
  18. //Constructor
  19. public LoginDialog(){
  20. Container container = getContentPane();
  21. container.setLayout(new FlowLayout(FlowLayout.LEFT));
  22. label1= new JLabel("Login name :");
  23. label1.setBounds(10,10,80,20);
  24. label2= new JLabel(" Password :");
  25. label2.setBounds(10,40,80,20);
  26. user= new JTextField(20);
  27. user.setBounds(100,10,100,20);
  28. password=new JPasswordField(20);
  29. password.setBounds(100,40,100,20);
  30. label3= new JLabel(" Server :");
  31. label3.setBounds(10,70,80,20);
  32. label4= new JLabel(" Port :");
  33. label4.setBounds(10,100,80,20);
  34. server= new JTextField(SERVER_HOST);
  35. server.setBounds(100,70,100,20);
  36. port=new JTextField(SERVER_PORT+"");
  37. port.setBounds(100,100,100,20);
  38. port.setEditable(true);
  39. ok=new JButton("Login");
  40. ok.setBounds(30,130,70,20);
  41. cancel= new JButton("Cancel");
  42. cancel.setBounds(110,130,80,20);
  43.  
  44. container.add(label1);
  45. container.add(user);
  46. container.add(label2);
  47. container.add(password);
  48. container.add(label3);
  49. container.add(server);
  50. container.add(label4);
  51. container.add(port);
  52. container.add(ok);
  53. container.add(cancel);
  54.  
  55. user.addActionListener(this);
  56. password.addActionListener(this);
  57. server.addActionListener(this);
  58. port.addActionListener(this);
  59. ok.addActionListener(this);
  60. cancel.addActionListener(this);
  61. setSize(250,210);
  62. setLocation(400,250);
  63. }
  64. public void actionPerformed(ActionEvent e)
  65. {
  66. if((e.getSource() == ok) || (e.getSource() == password)
  67. ||(e.getSource() == user) || (e.getSource() == server) ) {
  68. Username = user.getText();
  69. Password = new String(password.getPassword());
  70. Server = server.getText();
  71. if(Server.length()== 0){
  72. JOptionPane.showMessageDialog(this,
  73. "Invalid server host","Error",
  74. JOptionPane.WARNING_MESSAGE);
  75. return;
  76. }
  77. setVisible(false); //for OK Button of LoginDialog Class
  78. }
  79. else if(e.getSource() == cancel)
  80. setVisible(false);
  81. if(e.getSource()==ok){
  82. //Send data over socket
  83. String text =(ok.getText());
  84. //create socket connection
  85. try{
  86. client = new Socket("localhost",4444);
  87. } catch (IOException e1) {
  88. System.out.println("Could not listen on port 4444");
  89. System.exit(-1);
  90. }
  91. try{
  92. in = new BufferedReader(new InputStreamReader(client.getInputStream()));
  93. out = new PrintWriter(client.getOutputStream(), true);
  94. out.println(text);
  95. String line1 = in.readLine();
  96. String line2 = in.readLine();
  97. if (line1.equals(user.getText())) {
  98. user.setText(line1);
  99. password.setText(line2);
  100. }
  101. } catch (IOException e1) {
  102. System.out.println("Accept failed: 4444");
  103. System.exit(-1);
  104. }
  105. }
  106. }
  107. }
Quick reply to this message  
Closed Thread

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC