A Simple Server

try {
  ServerSocket ss = new ServerSocket(2345);
  Socket s = ss.accept();
  PrintWriter pw = new 
  PrintWriter(s.getOutputStream());
  pw.println("Hello There!");
  pw.println("Goodbye now.");
  s.close();
}
catch (IOException ex) {
  System.err.println(ex);
}

Previous | Next | Top | Cafe con Leche

Copyright 2003 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified February 13, 2003