@@ -0,0 +1,993 @@
+import java.io.*; %0Aimport java.net.*; %0Apublic class server2%0A%7B%0Apublic static void main(String%5B%5D args) throws Exception%0A%7B%0A//create server socket%0AServerSocket sersock2 = new ServerSocket(5000);%0ASystem.out.println(%22DeCentralized Server ready for communication%22);%0A//Make the server wait till a client accepts connection%0ASocket sock2 = sersock2.accept( );%0A//Sending to client%0ABufferedReader keyRead2 = new BufferedReader(new InputStreamReader(System.in));%0AOutputStream ostream2 = sock2.getOutputStream();%0A//To accept contents from client%0APrintWriter pwrite2 = new PrintWriter(ostream2, true);%0AInputStream istream2 = sock2.getInputStream();%0ABufferedReader receiveRead2 = new BufferedReader(new InputStreamReader(istream2));%0A//Read contents from the client%0AString receiveMessage2, sendMessage2;%0Awhile(true)%0A%7B%0Aif((receiveMessage2 = receiveRead2.readLine()) != null) %0A%7B %0ASystem.out.println(receiveMessage2);%0A%7D%0AsendMessage2 = keyRead2.readLine();%0Apwrite2.println(sendMessage2);%0ASystem.out.flush();%0A%7D %7D %7D%0A

Create server2.java