Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.51 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.     private void listen(int port) throws IOException {
  2.         ss = new ServerSocket(port);
  3.         System.out.println("Listening on " + ss);
  4.         while (true) {
  5.             Socket s = ss.accept();
  6.             System.out.println("Connection from " + s.getLocalAddress().getHostName());
  7.             DataOutputStream dout = new DataOutputStream(s.getOutputStream());
  8.             outputStreams.put(s, dout);
  9.             System.out.println(""+dout);
  10.             new ServerThread(this, s, id);
  11.         }
  12.     }