Total members 9951 | Gratitudes |It is currently Sat Feb 11, 2012 9:21 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 9 posts ] 
Author Question
 Question subject: Client-Server Forum discussion
PostPosted: Thu Dec 03, 2009 11:24 am 
Offline
Newbie
User avatar

Joined: Thu Dec 03, 2009 11:15 am
Posts: 4
Has thanked: 0 time
Have thanks: 0 time

Hello guys,

I need to make a Client-Server type Forum discussion board. It's very complicated for me because i have never done anything simillar before.And i don't have much time..

Can someone tell me from where to start, is there any finished project of this type? I will be grateful for any help!

:wave:


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Client-Server Forum discussion
PostPosted: Fri Dec 04, 2009 12:31 pm 
Offline
Mastermind
User avatar

Joined: Tue Mar 27, 2007 10:55 pm
Posts: 2103
Location: Earth
Has thanked: 39 time
Have thanks: 56 time
what is Client - Server type forum ?

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Client-Server Forum discussion
PostPosted: Fri Dec 04, 2009 9:06 pm 
Offline
Newbie
User avatar

Joined: Thu Dec 03, 2009 11:15 am
Posts: 4
Has thanked: 0 time
Have thanks: 0 time
Well, i need to create a program in Java,which will represent Forum discussion board that will work in same way as any other regular forum on the internet (so as this one :-)
So, what I know is that client will have some classes, server also,and client should be able to write topics (and articles in every topic,of course) which will be then stored on the server somehow..
So it will have same functionality as any regular Forum Discussion Board on the internet (but simplified as mush as possible :),

I hope I was clear:)


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Client-Server Forum discussion
PostPosted: Sun Dec 06, 2009 4:54 pm 
Offline
Newbie
User avatar

Joined: Thu Dec 03, 2009 11:15 am
Posts: 4
Has thanked: 0 time
Have thanks: 0 time
OK guys, here is what i figured for these days:
I know for sure that i will need to have two classes (and some other of course) - Client.java & Server.java

Client.java :
Code:
import java.net.*;
import java.io.*;
public class Client {
  public static void main(String args[]) throws IOException {
   
    Socket clientSocket = new Socket("localhost",1234);  // Open your connection to a server, at port 1234
   

    DataInputStream dis = new DataInputStream(clientSocket.getInputStream()); // for receiveng from server
    DataOutputStream dos = new DataOutputStream( clientSocket.getOutoupStream()); // for sending to server
    String st = new String (dis.readUTF());
    System.out.println(st);
   
// When done, just close the connection and exit
    dis.close();
    s1In.close();
    s1.close();
  }
}


Server.java :
Code:
import java.net.*;
import java.io.*;
public class Server {
  public static void main(String args[]) throws IOException {
   
    ServerSocket serverSocket = new ServerSocket(1234);  // Register service on port 1234
    Socket connectionSocket =serverSocket.accept(); // Wait and accept a connection
    // Get a communication stream associated with the socket
    DataInputStream dis = new DataInputStream(connectionSocket.getInputStream());  /for receiving from client
    DataOutputStream dos = new DataOutputStream( connectionSocket.getOutoupStream()); // for sending to client
    // Send a string!
    dos.writeUTF("Hi there");
    // Close the connection, but not the server socket
    dos.close();
    s1out.close();
    s1.close();
  }
}


So,this is the basic of communication between server and client,
but what next? How to make client to write articles, and how to make server to store that articles?Can i store them in ordinar .txt files? This is important because i suppose that everytime when client connects to server he need to download ALL the topics and articles that are posted before, and so i need to figure out through which algoritm i can do that..


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Client-Server Forum discussion
PostPosted: Mon Dec 07, 2009 12:57 am 
Offline
Mastermind
User avatar

Joined: Tue Mar 27, 2007 10:55 pm
Posts: 2103
Location: Earth
Has thanked: 39 time
Have thanks: 56 time
And example of writing and reading of sockets is here to , Java chat using socket programming .
hello , my friend ,
i think you will need to store the articles in database . Using JDBC . this is better to handle than files in such case. concerning . to be it seems you want to send objects from server to client . why don't you using RMI .

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Client-Server Forum discussion
PostPosted: Mon Dec 21, 2009 12:02 am 
Offline
Newbie
User avatar

Joined: Thu Dec 03, 2009 11:15 am
Posts: 4
Has thanked: 0 time
Have thanks: 0 time
I will use XML instead of Databases, because i'm not familiar with them at all!

But i'm having one problem:

I made a GUI for client and when i assign action to some button (i want to send a simple sentence to Server) nothing happens!

Here is the most important code:

Code:
   public void Connect(){
      String Adress = getAdressServer().getText();
      
      try {
         
          clientSocket = new Socket(Adress,1234);
          DOS = new DataOutputStream(clientSocket.getOutputStream());
          DIS = new DataInputStream(clientSocket.getInputStream());
         
      } catch (UnknownHostException e) {
         // TODO Auto-generated catch block
      System.out.println("Neispravna adresa servera");
      } catch (IOException e) {
      System.out.println("Neispravan unos");
      }
      
   }


   private JButton getSende() {
      if (POSALJI == null) {
         Send = new JButton();
         Send.setBounds(new Rectangle(351, 197, 136, 28));
         Send.setText("SEND");
         Send.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {

            try {
               DOS.WriteUTF(getSentence.getText());
            } catch (Exception e1) {
               // TODO Auto-generated catch block
               e1.printStackTrace();
            }
               
            }
         });
      }
      return Send;
   }



I know that code for Server class is working well, because i tested it with some other much simplifed class...

Any help?


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Client-Server Forum discussion
PostPosted: Mon Jul 05, 2010 8:19 pm 
Offline
Newbie
User avatar

Joined: Mon Jul 05, 2010 8:05 pm
Posts: 1
Has thanked: 0 time
Have thanks: 0 time
I like your Client Server Project.
I need a Chat Server project between two System for my summer project. I also want to transfer files or smiley in the same project. So can you help me out.
Please send me java code as soon as possible along with step by step procedure to execute...


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Client-Server Forum discussion
PostPosted: Thu Jul 22, 2010 1:13 pm 
Offline
Newbie
User avatar

Joined: Mon Jul 19, 2010 1:17 pm
Posts: 3
Has thanked: 0 time
Have thanks: 0 time
This project sounds good.
You got nice ideas.
Keep it up!


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Client-Server Forum discussion
PostPosted: Fri Sep 24, 2010 4:39 am 
Offline
Newbie
User avatar

Joined: Tue Sep 07, 2010 9:18 am
Posts: 30
Has thanked: 0 time
Have thanks: 1 time
I really don't understand what are you talking about??? :think:
Please specify something about your project.
May be i can also help you..... :Coo2:

_________________
Robinetterie industrielle


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 9 posts ] 
Quick reply


  


 Similar topics
 Topic title   Forum   Author   Comments 
 Ajax Source code to Suggest application with JSP Server side  AJAX  msi_333  5
 RMI EXAMPLE FOR CLIENT SERVER ARCHITECTURE CODE ?????  Java  Anonymous  0
 client server problem  Java  bablu1790  0
 HELP CONNECT SQL SERVER 2005 WITH PHP 5.2.6  PHP  orion  0
 Accessing files in remote server (unix/windows) using JSP  Servlets / JSP  kishore007  4

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 2 guests



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team