All pastes #938556 Raw Edit

Unbenannt

public java v1 · immutable
·published 2008-03-11 18:51 UTC
rendered paste body
import java.net.*;import java.io.*;public class ServerController extends Thread {	/**	 * @param args	 */	private static int port = 0;	private ServerSocket serverSocket = null;	private boolean serverRunning = true;		public static void main(String[] args) {		// TODO Auto-generated method stub		port = 4444;		ServerController myServController = new ServerController();		myServController.start();	}		public void die() {		this.serverRunning = false;	}	    public void run() {        try {            serverSocket = new ServerSocket(port);        } catch (IOException e) {            System.out.println("Could not listen on port: "+port);            System.exit(-1);        }    	while (serverRunning) {	        try {	            new Server(serverSocket.accept(),this);	        } catch (IOException e) {	            System.out.println("Accept failed: 4444");	        }	    }    }}