lunedì 27 aprile 2009

CLIENTE.JAVA 27-04-2009
import java.io.*;
import java.net.*;
public class Cliente{
String sentence;
String modifiedSentence;
Socket s;
BufferedReader inFromUser;
DataOutputStream outToServer;
BufferedReader inFromServer;
public Cliente (){
try{
s=new Socket("192.168.3.25",60000);
inFromUser=new BufferedReader(new InputStreamReader(System.in));
outToServer=new DataOutputStream(s.getOutputStream());
inFromServer=new BufferedReader(new InputStreamReader(s.getInputStream()));
sentence= inFromUser.readLine();
outToServer.writeBytes(sentence + '\n');
modifiedSentence= inFromServer.readLine();
System.out.println(modifiedSentence);
} catch (IOException ex){
ex.printStackTrace();
}
}
public static void main(String[] args){
Cliente c=new Cliente();
}
}

Nessun commento: