@@ -0,0 +1,1382 @@
+package com.chat.server;%0A%0Aimport java.io.IOException;%0Aimport java.io.PrintStream;%0Aimport java.net.ServerSocket;%0Aimport java.net.Socket;%0Aimport java.util.ArrayList;%0Aimport java.util.Collections;%0Aimport java.util.List;%0A%0Apublic class ChatServer %7B%0A%09private static ServerSocket serverSocket = null;%0A%09// The client socket.%0A%09private static Socket clientSocket = null;%0A%09// List of the clients currently connected to the Server%0A%09private static final List%3CClientThreads%3E threads=Collections.synchronizedList(new ArrayList%3CClientThreads%3E());%0A%09private static final int maxClients=10;%0A%09private String filePath;%0A%09public ChatServer()%7B%7D%0A%09public ChatServer(String filePath)%7B%0A%09%09this.filePath=filePath;%0A%09%7D%0A%09public void getServer(int portNumber)%7B%0A%09%09try %7B%0A%09%09%09System.out.println(%22Welcome server!!%22);%0A%09%09%09serverSocket = new ServerSocket(portNumber);%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09System.out.println(e);%0A%09%09%7D%0A%0A%09%09while (true) %7B%0A%09%09%09try %7B%0A%09%09%09%09clientSocket = serverSocket.accept();%0A%09%09%09%09PrintStream os = new PrintStream(clientSocket.getOutputStream());%0A%09%09%09%09ClientThreads clientobj=new ClientThreads(clientSocket, threads, filePath);%0A%09%09%09%09threads.add(clientobj);%0A%09%09%09%09clientobj.start();%0A%09%09%09%09if (threads.size() == maxClients) %7B%0A%09%09%09%09%09os.println(%22Server is too busy now. Please try again later.%22);%0A%09%09%09%09%09os.close();%0A%09%09%09%09%09clientSocket.close();%0A%09%09%09%09%7D%0A%09%09%09%7D catch (IOException e) %7B%0A%09%09%09%09System.out.println(e);%0A%09%09%09%7D%0A%09%09%7D%09%0A%09%7D%0A%7D

Add ChatServer.java to com.chat.server package