@@ -0,0 +1,2046 @@
+package Main;%0Aimport java.net.*;%0Aimport java.io.*;%0A%0A/* %0AEnhanced and optimized for Moodfinder application by Amin Amini Maghsoud Bigy: 2012%0A*/%0A%0Apublic class Manager %7B%0A%09%0A%09static int total;%0A%09%0A  public static void main(String%5B%5D args) throws IOException %7B%0A%0A    //Get the id of the local machine%0A    //Declare an object to store your computer's name%0A    InetAddress computerAddr = null;%0A    //Now store the local computer's name%0A    try%7B%0A      computerAddr = InetAddress.getLocalHost();%0A    %7D%0A    catch(UnknownHostException e)%7B%0A      System.out.println(e);%0A    %7D%0A    //Now print it out to the screen%0A    //You will need to use this number in your client program%0A    //Anoying but necessary%0A    System.out.println(%22The address of this computer is... %22 + computerAddr.getHostName());%0A    // Now set up the server socket on port 4444 on the local machine%0A    // Change the port so that someone else does not connect to it%0A    //Set up the local variables%0A    ServerSocket serverSocket = null;%0A    boolean listening = true;%0A    // Make the server socket%0A    try %7B%0A      serverSocket = new ServerSocket(4444);%0A    %7D catch (IOException e) %7B%0A      System.err.println(%22Could not listen on port: 4444.%22);%0A      System.exit(-1);%0A    %7D%0A    System.out.println(%22Server started%22);%0A  /*Whenever a client attempts to connect on the%0A  serversocket setup above, setup a new connection.%0A  Do this forever%0A%0A  The new connections are made by launching a new%0A  execution thread Instance.  The argument%0A  serverSocket.accept means that the thread will%0A  connect to whichever client demanded the connection%0A  The start command just tells the Instance object%0A  to begin execution.%0A%0A  Every thread object has a run() method instead of a%0A  main() method.  Start() just tells the object to use%0A  the run() method to begin execution.  These threads%0A  will be timesliced by the operating system%0A%0A  */%0A    while (listening)%7B%0A    %09%0A      new Instance(serverSocket.accept()).start();%0A      %0A      System.out.println(%22New server thread started%22);%0A    %7D%0A    serverSocket.close();%0A  %7D%0A%7D%0A

Create Manager.java