
// TalkServer
// Burton Rosenberg
// Tue Jul 15 12:40:50 EDT 1997

// An example of using sockets. See also TalkClient

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

public class TalkServer {

   static final int PORT_NUMBER = 2234 ;

   public static void main( String [] args ) {
      
       ServerSocket server ;
       Socket theConnection ;
       InputStream is ;
       OutputStream os ;
       DataInputStream dis ;

       try { 

          server = new ServerSocket( PORT_NUMBER ) ;
          theConnection = server.accept() ;

          is = theConnection.getInputStream() ;
          os = theConnection.getOutputStream() ;
          dis = new DataInputStream( is ) ;

          String lineOfInput ;
          while ( (lineOfInput = dis.readLine()) != null ) {
             System.out.println(lineOfInput) ;
          }

          theConnection.close() ;
          server.close() ;
       }
       catch ( IOException ioe ) {
           System.out.println("Error: "+ ioe.getMessage() ) ;
       }

   }

}
