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!
msi_333
Question subject: Re: Client-Server Forum discussion
Posted: Fri Dec 04, 2009 12:31 pm
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 )
Jashko
Question subject: Re: Client-Server Forum discussion
Posted: Fri Dec 04, 2009 9:06 pm
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:)
Jashko
Question subject: Re: Client-Server Forum discussion
Posted: Sun Dec 06, 2009 4:54 pm
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..
msi_333
Question subject: Re: Client-Server Forum discussion
Posted: Mon Dec 07, 2009 12:57 am
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 )
Jashko
Question subject: Re: Client-Server Forum discussion
Posted: Mon Dec 21, 2009 12:02 am
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());
I know that code for Server class is working well, because i tested it with some other much simplifed class...
Any help?
nitishz
Question subject: Re: Client-Server Forum discussion
Posted: Mon Jul 05, 2010 8:19 pm
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...
rein08
Question subject: Re: Client-Server Forum discussion
Posted: Thu Jul 22, 2010 1:13 pm
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!
doyoubuzz
Question subject: Re: Client-Server Forum discussion
Posted: Fri Sep 24, 2010 4:39 am
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??? Please specify something about your project. May be i can also help you.....