- private void listen(int port) throws IOException {
- ss = new ServerSocket(port);
- System.out.println("Listening on " + ss);
- while (true) {
- Socket s = ss.accept();
- System.out.println("Connection from " + s.getLocalAddress().getHostName());
- DataOutputStream dout = new DataOutputStream(s.getOutputStream());
- outputStreams.put(s, dout);
- System.out.println(""+dout);
- new ServerThread(this, s, id);
- }
- }