rendered paste bodypackage org.saweko.fun;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.net.ServerSocket;import java.net.Socket;public class ServerMain { public ServerMain() { try { ServerSocket s = new ServerSocket(6666); while (true) { new ServerConnection(this, s.accept()); Thread.sleep(100); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void acceptInfo(String info) { System.out.println(info); } public static void main(String args[]) { new ServerMain(); }}class ServerConnection extends Thread { private ServerMain myServer; private Socket myConn; public ServerConnection(ServerMain myServer, Socket existingConnection) { super("Conn:" + existingConnection.getInetAddress().getHostAddress()); this.myServer = myServer; this.myConn = existingConnection; start(); } @Override public void run() { try { BufferedReader bin = new BufferedReader(new InputStreamReader( myConn.getInputStream())); while (true) { myServer.acceptInfo(bin.readLine()); } } catch (IOException e) { e.printStackTrace(); } }}