Total members 11889 |It is currently Fri Mar 29, 2024 2:37 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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:




Author:
Newbie
User avatar Posts: 4
Have thanks: 0 time

what is Client - Server type forum ?

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 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:)


Author:
Newbie
User avatar Posts: 4
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..


Author:
Newbie
User avatar Posts: 4
Have thanks: 0 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 .

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 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?


Author:
Newbie
User avatar Posts: 4
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...


Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time

This project sounds good.
You got nice ideas.
Keep it up!


Author:
Newbie
User avatar Posts: 3
Have thanks: 0 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:


Author:
Newbie
User avatar Posts: 27
Have thanks: 1 time
Post new topic Reply to topic  [ 9 posts ] 

  Related Posts  to : Client-Server Forum discussion
 client server client     -  
 FTP Server and FTP Client     -  
 client server problem     -  
 UDP server and UDP client (J2SE)     -  
 Client Server Mobile to PC Application     -  
 need java client/server code     -  
 A Simple Client Server Multicasting     -  
 how to connect client on one machine with server     -  
 RMI EXAMPLE FOR CLIENT SERVER ARCHITECTURE CODE ?????     -  
 copy files from applet server to client     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com