Professional Documents
Culture Documents
DC Experiment No 2
DC Experiment No 2
ID:vu1f2021100
DIV:B Batch:C
Distributed Computing
Experiment No.2
Server Side:
import java.io.BufferedReader; import
java.io.IOException; import
java.io.InputStreamReader; import
java.net.ServerSocket; import java.net.Socket;
import java.util.Date; public class Server {
public static void main(String[] args) {
try {
// Create a server socket on port 12345
System.out.println("Client connected!");
// Create input stream to read data from the client
InputStreamReader(clientSocket.getInputStream()));
// Read data from the client
e.printStackTrace();
Client Side:
import java.io.BufferedReader; import
java.io.IOException; import
java.io.InputStreamReader; import
java.net.Socket; public class Client {
public static void main(String[] args) {
try {
// Connect to the server on localhost and port 12345
InputStreamReader(socket.getInputStream()));
// Read the response from the server
}
Name:Suyash Jadhav
ID:vu1f2021100
DIV:B Batch:C
Distributed Computing
OUTPUT: