/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package netzprog02_j_ultimatefinal;

import java.io.IOException;
import java.net.*;

/**
 *
 * @author Daniel Leese
 */
public class WaitForWorker implements Runnable {

    private int port = 4321;
    private List list = null;

    public WaitForWorker() {
        list = List.getInstnce();
    }

    public void run() {
        ServerSocket ssock = null;
        try {
            ssock = new ServerSocket(port);
            System.out.println("server laeuft :)");
            while (true) {
                Socket csock = null;
                csock = ssock.accept();
                new ServerWorker(csock);
            }
        } catch (UnknownHostException e) {
            System.err.println(e);
        } catch (IOException e) {
            System.err.println(e);
        } finally {
            if (ssock != null) {
                try {
                    ssock.close();
                } catch (IOException e) {
                    System.err.println(e);
                }
            }
        }
    }
}