Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi...
i want to start making massenger in java ...
i know database, network in java...
but i need help of how to start...
Posted
Updated 30-Mar-10 11:30am
v2

try here: Java Messenger Code[^]
 
Share this answer
 
 
Share this answer
 
hello,
I have an idea, inspired by a tp that I already do, the consept and creates a dialoge box between the server and the client or the client sending the request and the server replied, a loop 10 essay, essaey of deVolpi consept what we create a dialog [cat] Here is the source code
Java
//http://ijtihed.com
// CLIENT
import java.io.*;
import java.net.*;
public class ClientTCP {

	public static void main(String[] args)throws Exception {
				for(int i=0;i<10;i++){
		Socket socket = new Socket("127.0.0.1", 5555);
		System.out.println("faite entre le message");
				
		   InputStreamReader reader = new InputStreamReader(socket.getInputStream());
		   BufferedReader istream = new BufferedReader(reader);
		   BufferedReader entre = new BufferedReader ( new InputStreamReader (System.in));
		   String line = entre.readLine();
		PrintWriter ostream = new PrintWriter(socket.getOutputStream());
		ostream.println(line);
		ostream.flush();
		
		String phrase = istream.readLine().toString();
		System.out.println(phrase);
		}}}
//SERVER
import java.io.*;
import java.net.*;
public class ServeurTCP {

	public static void main(String[] args)throws Exception {
			
		ServerSocket server = new ServerSocket(5555);
		
		System.out.println("il faut attendre ... et execute le client");
		while(true){
		Socket socket = server.accept();
		   InputStreamReader reader = new InputStreamReader(socket.getInputStream());
		   BufferedReader istream = new BufferedReader(reader);
		   
		   String line = istream.readLine().toString(); 
		   BufferedReader entre = new BufferedReader ( new InputStreamReader (System.in));
		   System.out.println("message client : "+"  "+line+"   "+"entrer la repense du serveur");
		   String nphrase = entre.readLine();

		PrintWriter ostream = new PrintWriter(socket.getOutputStream());
		ostream.println(nphrase);
		ostream.flush();
	}}}	
 
Share this answer
 
hello,
I have an idea, inspired by a tp that I already do, the consept and creates a dialoge box between the server and the client or the client sending the request and the server replied, a loop 10 essay, essaey of deVolpi consept what we create a dialog [cat] Here is the source code
<pre lang="java">
//http://ijtihed.com
// CLIENT
import java.io.*;
import java.net.*;
public class ClientTCP {

public static void main(String[] args)throws Exception {
for(int i=0;i<10;i++){
Socket socket = new Socket("127.0.0.1", 5555);
System.out.println("faite entre le message");

InputStreamReader reader = new InputStreamReader(socket.getInputStream());
BufferedReader istream = new BufferedReader(reader);
BufferedReader entre = new BufferedReader ( new InputStreamReader (System.in));
String line = entre.readLine();
PrintWriter ostream = new PrintWriter(socket.getOutputStream());
ostream.println(line);
ostream.flush();

String phrase = istream.readLine().toString();
System.out.println(phrase);
}}}
//SERVER
import java.io.*;
import java.net.*;
public class ServeurTCP {

public static void main(String[] args)throws Exception {

ServerSocket server = new ServerSocket(5555);

System.out.println("il faut attendre ... et execute le client");
while(true){
Socket socket = server.accept();
InputStreamReader reader = new InputStreamReader(socket.getInputStream());
BufferedReader istream = new BufferedReader(reader);

String line = istream.readLine().toString();
BufferedReader entre = new BufferedReader ( new InputStreamReader (System.in));
System.out.println("message client : "+" "+line+" "+"entrer la repense du serveur");
String nphrase = entre.readLine();

PrintWriter ostream = new PrintWriter(socket.getOutputStream());
ostream.println(nphrase);
ostream.flush();
}}}
</pre>
 
Share this answer
 
Comments
RaviRanjanKr 9-Dec-11 14:59pm    
Why are you posting same answer twice. You have already posted same one already.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900