1  /* Adapted from an example by
  2   * Gary Cornell and Cay S. Horstmann, Core Java (Book/CD-ROM)
  3   */
  4   
  5  
  6  import java.io.*;
  7  import java.net.*;
  8  
  9  class SocketTest
 10  {  public static void main(String[] args)
 11     {  try
 12        {  Socket t = new Socket("osprey7.npac.syr.edu", 13);
 13        
 14           DataInputStream is = new DataInputStream(t.getInputStream());
 15           boolean more = true;
 16           while (more)
 17           {  String str = is.readLine();
 18              if (str == null) more = false;
 19              else
 20                 System.out.println(str);
 21           }
 22           
 23        } 
 24        catch(IOException e) { System.out.println("Error" + e); }
 25     }
 26  
 27  }