Java Reference
In-Depth Information
try{
ssock.close();
} catch (IOException ex) {
System.out.println(ex);
}
}
}
public static void communicateWithClient(Socket
socket) {
BufferedReader in = null;
PrintWriter out = null;
try {
in = new BufferedReader(
new
InputStreamReader(socket.getInputStream()));
out = new PrintWriter(
socket.getOutputStream(), true);
String s = null;
out.println("Server received communication!");
while ((s = in.readLine()) != null) {
System.out.println("received from client:
" + s);
out.flush();
break;
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
in.close();
out.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
Search WWH ::




Custom Search