import java.io.*; import java.util.*; import java.net.*; public class SimpleMultiThreadServer { public static void main(String args[]){ myServer ws = new myServer(args[0]); ws.start(); } } class myServer extends Thread { myServer(String confpath) { ... } // constructors synchronized public static void Slog(String writeln) { ...} // use slog() to keep a log of all activities public void run() { // redefine run method for handling multiple clients... ServerSocket ss = new ServerSocket(PortNumber); myServer.slog("server started or not log... after conditional on ss"); While (true) { //listen on the port for client connections Socket cs = ss.accept(); //client socket // can check at this point whether client is acceptable using IPaddresses in confFile // use cs.getInetAddress() and compare against your database in confFile ClientThread ct = new ClientThread(confpath,cs); // create a client thread if client is acceptable ct.start(); // start the thread to service the client } } class ClientThread extends Thread { String confpath; BufferedReader br; PrintWriter pw; Socket cs; ClientThread(String confpath,Socket cs){ // constructors this.confpath = confpath; this.cs = cs; br = new BufferedReader(new InputStreamReader(cs.getInputStream())); pw = new PrintWriter(cs.getOutputStream(),true); } public void run() { //rewrite run() method for clientThread ... readin = br.readLine(); // read from client ... writeout = new String("First userFriendly message sent from the server to client"); myServer.Slog(writeout); pw.print(writeout+"\r\n"); // write to client ... br.close(); pw.close(); cs.close(); }