Compare commits
No commits in common. "80097cfc6bf245cde3e2b6eac255fa3577cf561f" and "698c2faaa86fa861411573f076c97be5ae5a1886" have entirely different histories.
80097cfc6b
...
698c2faaa8
2 changed files with 0 additions and 65 deletions
|
@ -1,34 +0,0 @@
|
|||
package chat;
|
||||
import java.net.*;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.DatagramSocket;
|
||||
|
||||
public class socket_client {
|
||||
public static void main (String [] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.println("Connecting to server...");
|
||||
Socket link = new Socket("localhost", 1234);//remplacer localhost par l'adresse IP du serveur
|
||||
System.out.println("Establishing I/O streams...");
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(link.getInputStream()));
|
||||
PrintWriter out = new PrintWriter(link.getOutputStream(),true);
|
||||
BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
|
||||
while(true)
|
||||
{
|
||||
String message = console.readLine();
|
||||
out.println("CLIENT:" + message);
|
||||
}
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
System.out.println("nik!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package chat;
|
||||
import java.net.*;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class mySocketClient {
|
||||
public static void main (String [] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.println("Connecting to server...");
|
||||
Socket link = new Socket("192.168.1.54", 1234);
|
||||
System.out.println("Establishing I/O streams...");
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(link.getInputStream()));
|
||||
PrintWriter out = new PrintWriter(link.getOutputStream(),true);
|
||||
BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
|
||||
while(true)
|
||||
{
|
||||
String message = console.readLine();
|
||||
out.println("CLIENT:" + message);
|
||||
}
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
System.out.println("nik!");
|
||||
}
|
Loading…
Reference in a new issue