n// SimpleServer.java: a
simple server program
nimport java.net.*;
nimport java.io.*;
npublic class
SimpleServer {
n public static void main(String args[]) throws IOException {
n // Register service on port 1234
n ServerSocket s = new ServerSocket(1234);
n Socket s1=s.accept(); // Wait and accept a connection
n // Get a communication stream associated
with the socket
n OutputStream s1out = s1.getOutputStream();
n DataOutputStream dos = new
DataOutputStream (s1out);
n // Send a string!
n dos.writeUTF("Hi there");
n // Close the connection, but not the
server socket
n dos.close();
n s1out.close();
n s1.close();
n }
n}