import java.net.*; import java.applet.*; import java.io.*; import java.awt.*; import java.lang.*; public class RNG extends Applet { OutputStream out; DataInputStream dis; Socket soc; byte[] response; String host; int port; int spot; public void init () { response=new byte[101]; host="www.cs.uwm.edu"; port=5007; } public void start () { try { soc=new Socket(host,port); out=new DataOutputStream(soc.getOutputStream()); InputStream instream=soc.getInputStream(); DataInputStream dis=new DataInputStream(instream); } catch (Exception e) { System.err.println(e); System.exit(1); } try { out.write(5); out.flush(); System.out.println("Request sent.."); } catch (Exception e) { System.err.println(e); System.exit(2); } try { spot=0; while ( (spot<100) && (response[spot]!='\n') ) { byte b=dis.readByte(); response[spot]=b; spot=spot+1; } } catch (Exception e) { System.err.println(e); System.exit(5); } try { spot=0; while ( spot<100 ) { System.out.println(response[spot]); spot=spot+1; } } catch (Exception e) { System.err.println(e); System.exit(6); } } }