Dwi Anggoro laporan jarter
-
Upload
budi-setiyo-utomo -
Category
Documents
-
view
213 -
download
0
description
Transcript of Dwi Anggoro laporan jarter
MAKALAH JARINGAN TERDISTRIBUSI
LABSHEET 05 MULTICLIENT SERVER
Oleh:
DWI ANGGORO
12520241068
Server: A. MultithreadingServer yang digunakan adalah Multithreading server, dimana client yang melakukan komunikasi bersifat loopback. Maksudnya adalah, server ketika setiap menerima komunikasi dalam pengiriman dan penerimaan data, akan bersifat terus menerus.// Start the new thread
Thread t = new Thread(task);//task.start();
t.start();
// Increment clientNo
clientNo++;Kalkulasi pekerjaan :// Receive radius from the client
double radius = inputFromClient.readDouble();
// Compute area
double ball = radius * radius * radius * Math.PI;
// Send area back to the client
outputToClient.writeDouble(ball);
jta.append("Calculate the Volume of Ball" + '\n');
jta.append("radius received from client: " +
side + '\n');
jta.append("Volume found: " + ball + '\n');2. Client try {
// Get the radius from the text field
double radius = Double.parseDouble(jtf.getText().trim());
// Send the radius to the server
toServer.writeDouble(radius);
toServer.flush();
// Get area from the server
double Ball = fromServer.readDouble();
// Display to the text area
jta.append("Ball's Volume" + "\n");
jta.append("Radius is " + radius + "\n");
jta.append("Ball's volume received from the server is "
+ Ball + '\n');
}Cara kerjanya adalah bahwa Client mengirim inputan dan menerima outputan dari server