1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
InputStream inputStream = serverSocket.getInputStream();
serverIn = new DataInputStream(new BufferedInputStream(inputStream));
OutputStream outputStream = clientSocket.getOutputStream();
clientOut = new DataOutputStream(new BufferedOutputStream(outputStream));
...
int bytesRead;
byte[] reponse = new byte[4096];
String response = "";
try{
while ((bytesRead = serverIn.read(reponse)) > 0) {
String string = new String(reponse);
response += string;
clientOut.write(reponse, 0, bytesRead);
clientOut.flush();
}
}catch(Exception e){
System.out.println(e.getMessage());
}
System.out.println("message lu du serveur");
System.out.println(response); |
Partager